From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E9D5C433E0 for ; Wed, 17 Jun 2020 16:26:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D335621556 for ; Wed, 17 Jun 2020 16:26:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="PC3gjrTD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D335621556 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 670DE6B0002; Wed, 17 Jun 2020 12:26:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5FAD36B0005; Wed, 17 Jun 2020 12:26:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4EA4D6B000A; Wed, 17 Jun 2020 12:26:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0245.hostedemail.com [216.40.44.245]) by kanga.kvack.org (Postfix) with ESMTP id 338536B0002 for ; Wed, 17 Jun 2020 12:26:49 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D2275807C21B for ; Wed, 17 Jun 2020 16:26:48 +0000 (UTC) X-FDA: 76939232496.14.straw43_3601fbb26e09 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id 9EADD181BCB2A for ; Wed, 17 Jun 2020 16:26:48 +0000 (UTC) X-HE-Tag: straw43_3601fbb26e09 X-Filterd-Recvd-Size: 2520 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Wed, 17 Jun 2020 16:26:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=VQvAKQ+aQCqnrbW97QIaAzwZ2mOsoMkKAcRjI526Ur4=; b=PC3gjrTDx1j9O7ps1TBIkgkLeX 7JwW2jYkxTqxWC3do0eGCliJ0TAR1X7zYfNyQ7StUS+sAQGYYSWKrGg+VItWpR3T8OLa7KA2ET6hm 4/Xf+pc1sZt0TBbAKIge7DkoDwJ8eKL7+OdjSIXBc+89PQwgdsJj9NfbtRunnwohfcrh9pSGaeVh/ icb4rn0i76IOyTaOxcwdo8ADtMnhKx2txHyYip7dzAxzkypnDIUHkL4CzqH0d5xo4R4OZ2ap+CsjA Mgt2q1r0FcKTSmoc31E9jin4jnk/ppUtpGYWag6oYDd7zcnKUybiV6o5pejU75CTWerUIlRCIkIjK htFmszZA==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jlatf-00008G-Cp; Wed, 17 Jun 2020 16:26:43 +0000 Date: Wed, 17 Jun 2020 09:26:43 -0700 From: Matthew Wilcox To: Christopher Lameter Cc: William Kucharski , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton Subject: Re: [PATCH] mm: ksize() should silently accept a NULL pointer Message-ID: <20200617162643.GK8681@bombadil.infradead.org> References: <20200616225409.4670-1-william.kucharski@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 9EADD181BCB2A X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Jun 17, 2020 at 04:23:04PM +0000, Christopher Lameter wrote: > On Tue, 16 Jun 2020, William Kucharski wrote: > > > Other mm routines such as kfree() and kzfree() silently do the right > > thing if passed a NULL pointer, so ksize() should do the same. > > Ok so the size of an no object pointer is zero? Ignoring the freeing > of a nonexisting object makes sense. But determining it size? ksize() is misnamed. It's not the size of the object, it's the number of bytes allocated for that object. A NULL pointer represents a freed object, or one that was never allocated in the first place. Clearly that's 0 bytes. What other answer would make sense?