diff mbox

[1/1] scsi: fnic: add a space after %p in printf format

Message ID 20171210192311.5334-1-nicolas.iooss_linux@m4x.org (mailing list archive)
State Accepted
Headers show

Commit Message

Nicolas Iooss Dec. 10, 2017, 7:23 p.m. UTC
fnic_fcpio_icmnd_cmpl_handler() displays the value of sc with:

    FNIC_SCSI_DBG(KERN_INFO...
        "... sc = 0x%p"
        "scsi_status ..."
        ...

As the literal strings get merged, the function uses %ps instead of the
intended raw %p format. Fix this by inserting a space.

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
---
 drivers/scsi/fnic/fnic_scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bart Van Assche Dec. 11, 2017, 10:22 p.m. UTC | #1
On Sun, 2017-12-10 at 20:23 +0100, Nicolas Iooss wrote:
> fnic_fcpio_icmnd_cmpl_handler() displays the value of sc with:

> 

>     FNIC_SCSI_DBG(KERN_INFO...

>         "... sc = 0x%p"

>         "scsi_status ..."

>         ...

> 

> As the literal strings get merged, the function uses %ps instead of the

> intended raw %p format. Fix this by inserting a space.

> 

> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>

> ---

>  drivers/scsi/fnic/fnic_scsi.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c

> index 242e2ee494a1..8cbd3c9f0b4c 100644

> --- a/drivers/scsi/fnic/fnic_scsi.c

> +++ b/drivers/scsi/fnic/fnic_scsi.c

> @@ -906,7 +906,7 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic,

>  

>  		FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host,

>  			"icmnd_cmpl abts pending "

> -			  "hdr status = %s tag = 0x%x sc = 0x%p"

> +			  "hdr status = %s tag = 0x%x sc = 0x%p "

>  			  "scsi_status = %x residual = %d\n",


Since the %p format specifier already inserts a 0x prefix, shouldn't 0x%p be changed
into %p?

Bart.
Nicolas Iooss Dec. 11, 2017, 10:54 p.m. UTC | #2
On Mon, Dec 11, 2017 at 11:22 PM, Bart Van Assche
<Bart.VanAssche@wdc.com> wrote:
>
> On Sun, 2017-12-10 at 20:23 +0100, Nicolas Iooss wrote:
> > fnic_fcpio_icmnd_cmpl_handler() displays the value of sc with:
> >
> >     FNIC_SCSI_DBG(KERN_INFO...
> >         "... sc = 0x%p"
> >         "scsi_status ..."
> >         ...
> >
> > As the literal strings get merged, the function uses %ps instead of the
> > intended raw %p format. Fix this by inserting a space.
> >
> > Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
> > ---
> >  drivers/scsi/fnic/fnic_scsi.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
> > index 242e2ee494a1..8cbd3c9f0b4c 100644
> > --- a/drivers/scsi/fnic/fnic_scsi.c
> > +++ b/drivers/scsi/fnic/fnic_scsi.c
> > @@ -906,7 +906,7 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic,
> >
> >               FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host,
> >                       "icmnd_cmpl abts pending "
> > -                       "hdr status = %s tag = 0x%x sc = 0x%p"
> > +                       "hdr status = %s tag = 0x%x sc = 0x%p "
> >                         "scsi_status = %x residual = %d\n",
>
> Since the %p format specifier already inserts a 0x prefix, shouldn't 0x%p be changed
> into %p?

Does it? On the kernel I use it does not, and the documentation for %p
does not show a 0x prefix
(https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/printk-formats.txt?h=v4.15-rc3#n57).

Nicolas
Bart Van Assche Dec. 11, 2017, 11:34 p.m. UTC | #3
On Mon, 2017-12-11 at 23:54 +0100, Nicolas Iooss wrote:
> On Mon, Dec 11, 2017 at 11:22 PM, Bart Van Assche

> <Bart.VanAssche@wdc.com> wrote:

> > On Sun, 2017-12-10 at 20:23 +0100, Nicolas Iooss wrote:

> > > -                       "hdr status = %s tag = 0x%x sc = 0x%p"

> > > +                       "hdr status = %s tag = 0x%x sc = 0x%p "

> > >                         "scsi_status = %x residual = %d\n",

> > 

> > Since the %p format specifier already inserts a 0x prefix, shouldn't 0x%p be changed

> > into %p?

> 

> Does it? On the kernel I use it does not, and the documentation for %p

> does not show a 0x prefix

> (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/printk-formats.txt?h=v4.15-rc3#n57).


Please ignore my comment.

Bart.
Martin K. Petersen Dec. 12, 2017, 2:43 a.m. UTC | #4
Nicolas,

> fnic_fcpio_icmnd_cmpl_handler() displays the value of sc with:

> As the literal strings get merged, the function uses %ps instead of the
> intended raw %p format. Fix this by inserting a space.

Applied to 4.16/scsi-queue. Thank you!
diff mbox

Patch

diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 242e2ee494a1..8cbd3c9f0b4c 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -906,7 +906,7 @@  static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic,
 
 		FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host,
 			"icmnd_cmpl abts pending "
-			  "hdr status = %s tag = 0x%x sc = 0x%p"
+			  "hdr status = %s tag = 0x%x sc = 0x%p "
 			  "scsi_status = %x residual = %d\n",
 			  fnic_fcpio_status_to_str(hdr_status),
 			  id, sc,