From patchwork Wed Jan 6 01:17:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 12000695 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=-19.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 0168AC433DB for ; Wed, 6 Jan 2021 01:17:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A0A9B22DD3 for ; Wed, 6 Jan 2021 01:17:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0A9B22DD3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D3DA98D00D2; Tue, 5 Jan 2021 20:17:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C6B7F8D00D1; Tue, 5 Jan 2021 20:17:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE4E68D00CF; Tue, 5 Jan 2021 20:17:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0060.hostedemail.com [216.40.44.60]) by kanga.kvack.org (Postfix) with ESMTP id 9435F8D006E for ; Tue, 5 Jan 2021 20:17:53 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 64D7C362C for ; Wed, 6 Jan 2021 01:17:53 +0000 (UTC) X-FDA: 77673588426.11.brain86_2d05685274dd Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 44F64180F8B80 for ; Wed, 6 Jan 2021 01:17:53 +0000 (UTC) X-HE-Tag: brain86_2d05685274dd X-Filterd-Recvd-Size: 2745 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Wed, 6 Jan 2021 01:17:52 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id D197F22D6F; Wed, 6 Jan 2021 01:17:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1609895871; bh=gLFu+KgQ4ck58W8mpBbjs74dHggSLHFYOf67lC5Cr3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uif8275PxW3KW/QFDS83CgQMCU8FRKEU74nYX24qobr0YhgYZ7Yat4jReuiCK9xBh i2YhNYMtxbwPSP2nctigH6YbL9EHvPP42z7n4AhQv1bDlpgkCM4iaD6Rpft217gQeM 2gvHLjq0fM20fgLr+R5SvOuMyQO/NTD8LhDDoKtxXhLS7hcAM9f8OqYKU0O0iOKm23 0cgFCUzXLXc33Bd59PYlhfBTutUNy5MGTRj+Tw3ykxsa/fSdwlhsKm0LVNmmVxH9zR zn5XseL8WDdomGn1DZ2EBqGN74Y/x2nXYZZDlu0+ykt3uYsXOk0fbCMuOMDvcJcq2A EF1wttLK4d63g== From: paulmck@kernel.org To: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-mm@kvack.org Cc: cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, ming.lei@redhat.com, axboe@kernel.dk, kernel-team@fb.com, "Paul E. McKenney" Subject: [PATCH mm,percpu_ref,rcu 2/6] mm: Make mem_dump_obj() handle NULL and zero-sized pointers Date: Tue, 5 Jan 2021 17:17:46 -0800 Message-Id: <20210106011750.13709-2-paulmck@kernel.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20210106011603.GA13180@paulmck-ThinkPad-P72> References: <20210106011603.GA13180@paulmck-ThinkPad-P72> 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: From: "Paul E. McKenney" This commit makes mem_dump_obj() call out NULL and zero-sized pointers specially instead of classifying them as non-paged memory. Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Cc: Andrew Morton Cc: Reported-by: Andrii Nakryiko Acked-by: Vlastimil Babka Signed-off-by: Paul E. McKenney --- mm/util.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm/util.c b/mm/util.c index da46f9d..92f23d2 100644 --- a/mm/util.c +++ b/mm/util.c @@ -997,7 +997,12 @@ int __weak memcmp_pages(struct page *page1, struct page *page2) void mem_dump_obj(void *object) { if (!virt_addr_valid(object)) { - pr_cont(" non-paged (local) memory.\n"); + if (object == NULL) + pr_cont(" NULL pointer.\n"); + else if (object == ZERO_SIZE_PTR) + pr_cont(" zero-size pointer.\n"); + else + pr_cont(" non-paged (local) memory.\n"); return; } if (kmem_valid_obj(object)) {