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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D12A6CE7B10 for ; Thu, 28 Sep 2023 09:27:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231614AbjI1J1d (ORCPT ); Thu, 28 Sep 2023 05:27:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231843AbjI1J1V (ORCPT ); Thu, 28 Sep 2023 05:27:21 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 199791B6 for ; Thu, 28 Sep 2023 02:27:18 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4432DC433C8; Thu, 28 Sep 2023 09:27:17 +0000 (UTC) Date: Thu, 28 Sep 2023 10:27:14 +0100 From: Catalin Marinas To: Liu Shixin Cc: Patrick Wang , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] mm/kmemleak: fix print format of pointer in pr_debug() Message-ID: References: <20230927035923.1425340-1-liushixin2@huawei.com> <20230927035923.1425340-4-liushixin2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230927035923.1425340-4-liushixin2@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 27, 2023 at 11:59:23AM +0800, Liu Shixin wrote: > With 0x%p, the pointer will be hashed and print (____ptrval____) instead. > And with 0x%pa, the pointer can be successfully printed but with duplicate > prefixes, which looks like: > > kmemleak: kmemleak_free(0x(____ptrval____)) > kmemleak: kmemleak_free_part_phys(0x0x0000000a1af86000) > > Use %pa instead of 0x%p or 0x%pa to print the pointer, and use 0x%px for > __percpu pointer to prevent crash. Then the print will be like: Why not %px in all cases? -- Catalin