linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: 郭志 <qtxuning1999@sjtu.edu.cn>
To: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
Cc: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>,
	dledford <dledford@redhat.com>,
	linux-rdma <linux-rdma@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] infiniband hfi1: fix misuse of %x in ipoib_tx.c
Date: Thu, 23 Sep 2021 20:51:37 +0800 (CST)	[thread overview]
Message-ID: <2038588983.392567.1632401497054.JavaMail.zimbra@sjtu.edu.cn> (raw)
In-Reply-To: <CH0PR01MB71536ECA05AA44C4FAD83502F2A29@CH0PR01MB7153.prod.exchangelabs.com>

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" <mike.marciniszyn@cornelisnetworks.com>
To: "Guo Zhi" <qtxuning1999@sjtu.edu.cn>, "Dennis Dalessandro" <dennis.dalessandro@cornelisnetworks.com>, "dledford" <dledford@redhat.com>
Cc: "linux-rdma" <linux-rdma@vger.kernel.org>, "linux-kernel" <linux-kernel@vger.kernel.org>
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 <qtxuning1999@sjtu.edu.cn>

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

  parent reply	other threads:[~2021-09-23 12:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-22 13:48 Guo Zhi
2021-09-22 17:51 ` Marciniszyn, Mike
2021-09-22 18:05   ` Bart Van Assche
2021-09-23  6:45     ` Leon Romanovsky
2021-09-23 11:04       ` Marciniszyn, Mike
2021-09-23 11:44         ` Leon Romanovsky
2021-09-23 12:18           ` Marciniszyn, Mike
2021-09-24  2:46       ` Bart Van Assche
2021-09-24 14:43         ` Marciniszyn, Mike
2021-09-25  0:20           ` Guo Zhi
2021-09-23 11:03     ` Marciniszyn, Mike
2021-09-23 13:15       ` Jason Gunthorpe
2021-09-23  2:03   ` 郭志
2021-09-23 12:51   ` 郭志 [this message]
2021-09-27 13:05 ` Marciniszyn, Mike
2021-09-27 17:42 ` Jason Gunthorpe
  -- strict thread matches above, loose matches on Subject: below --
2021-09-22 12:33 Guo Zhi
2021-09-22 12:37 ` Dennis Dalessandro
2021-09-24 14:46 ` Marciniszyn, Mike

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2038588983.392567.1632401497054.JavaMail.zimbra@sjtu.edu.cn \
    --to=qtxuning1999@sjtu.edu.cn \
    --cc=dennis.dalessandro@cornelisnetworks.com \
    --cc=dledford@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mike.marciniszyn@cornelisnetworks.com \
    --subject='Re: [PATCH] infiniband hfi1: fix misuse of %x in ipoib_tx.c' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).