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=-5.6 required=3.0 tests=BAYES_00, CHARSET_FARAWAY_HEADER,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 09E31C433F5 for ; Thu, 23 Sep 2021 12:52:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E6C5160F39 for ; Thu, 23 Sep 2021 12:52:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241000AbhIWMxV (ORCPT ); Thu, 23 Sep 2021 08:53:21 -0400 Received: from smtp179.sjtu.edu.cn ([202.120.2.179]:56256 "EHLO smtp179.sjtu.edu.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240787AbhIWMxL (ORCPT ); Thu, 23 Sep 2021 08:53:11 -0400 Received: from mta04.sjtu.edu.cn (mta04.sjtu.edu.cn [202.121.179.8]) by smtp179.sjtu.edu.cn (Postfix) with ESMTPS id 6AACD100B0956; Thu, 23 Sep 2021 20:51:37 +0800 (CST) Received: from localhost (localhost [127.0.0.1]) by mta04.sjtu.edu.cn (Postfix) with ESMTP id 5032F185F5217; Thu, 23 Sep 2021 20:51:37 +0800 (CST) X-Virus-Scanned: amavisd-new at mta04.sjtu.edu.cn Received: from mta04.sjtu.edu.cn ([127.0.0.1]) by localhost (mta04.sjtu.edu.cn [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id vJ3hqoUkK9xP; Thu, 23 Sep 2021 20:51:37 +0800 (CST) Received: from mstore105.sjtu.edu.cn (unknown [10.118.0.105]) by mta04.sjtu.edu.cn (Postfix) with ESMTP id 25B611804EE54; Thu, 23 Sep 2021 20:51:37 +0800 (CST) Date: Thu, 23 Sep 2021 20:51:37 +0800 (CST) From: =?gb2312?B?ufnWvg==?= To: Mike Marciniszyn Cc: Dennis Dalessandro , dledford , linux-rdma , linux-kernel Message-ID: <2038588983.392567.1632401497054.JavaMail.zimbra@sjtu.edu.cn> In-Reply-To: References: <20210922134857.619602-1-qtxuning1999@sjtu.edu.cn> Subject: Re: [PATCH] infiniband hfi1: fix misuse of %x in ipoib_tx.c MIME-Version: 1.0 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit X-Originating-IP: [202.120.40.82] X-Mailer: Zimbra 8.8.15_GA_4125 (ZimbraWebClient - GC92 (Linux)/8.8.15_GA_3928) Thread-Topic: infiniband hfi1: fix misuse of %x in ipoib_tx.c Thread-Index: AQHXr7imk55risfKAUmS2+aCDTMROauwTzmgxEEN6dM= Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org I have tried using %px rather than %p. However when checking the new patch through scripts/checkpatch.pl, there is a warning: Using vsprintf specifier '%px' potentially exposes the kernel memory layout. Maybe %pK is the right one? Thanks. Guo ----- Original Message ----- From: "Mike Marciniszyn" To: "Guo Zhi" , "Dennis Dalessandro" , "dledford" Cc: "linux-rdma" , "linux-kernel" Sent: Thursday, September 23, 2021 1:51:08 AM Subject: RE: [PATCH] infiniband hfi1: fix misuse of %x in ipoib_tx.c > Subject: [PATCH] infiniband hfi1: fix misuse of %x in ipoib_tx.c > > Pointers should be printed with %p or %px rather than cast to (unsigned long > long) and printed with %llx. > Change %llx to %p to print the pointer. > > Signed-off-by: Guo Zhi The unsigned long long was originally used to insure the entire accurate pointer as emitted. This is to ensure the pointers in prints and event traces match values in stacks and register dumps. I think the %p will obfuscate the pointer so %px is correct for our use case. Mike