Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1423441

[PATCH 2/2] scsi: wd7000: print sector number as 64-bit

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject [PATCH 2/2] scsi: wd7000: print sector number as 64-bit
Date 2016-06-15 23:00 +0200
Message-ID <rKq4N-7mg-3@gated-at.bofh.it> (permalink)
References <rKpV7-7iY-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Enabling format checking in dprintk() shows that wd7000_biosparam
uses an incorrect format string for sector_t:

drivers/scsi/wd7000.c: In function 'wd7000_biosparam':
drivers/scsi/wd7000.c:1594:21: error: format '%d' expects argument of type 'int', but argument 3 has type 'sector_t {aka long long unsigned int}' [-Werror=format=]

As sector_t can be 32-bit wide, this adds a cast to 'u64' and prints
that with the correct format. The change to use no_printk()
generally helps with finding this kind of hidden format string bug,
and I found that when building with "-Wextra", which warned about
an empty else clause in

       } else
              dprintk("ok!\n");

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
Not Cc'ing Miroslav Zagorac <zaga@fly.cc.fer.hr>, that address bounces
with "Requested action not taken: mailbox unavailable invalid DNS MX or A/AAAA resource record"

diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c
index 0c0f17b9a3eb..39a3b5333bd6 100644
--- a/drivers/scsi/wd7000.c
+++ b/drivers/scsi/wd7000.c
@@ -192,7 +192,7 @@
 #ifdef WD7000_DEBUG
 #define dprintk printk
 #else
-#define dprintk(format,args...)
+#define dprintk	no_printk
 #endif
 
 /*
@@ -1591,8 +1591,8 @@ static int wd7000_biosparam(struct scsi_device *sdev,
 {
 	char b[BDEVNAME_SIZE];
 
-	dprintk("wd7000_biosparam: dev=%s, size=%d, ",
-		bdevname(bdev, b), capacity);
+	dprintk("wd7000_biosparam: dev=%s, size=%lld, ",
+		bdevname(bdev, b), (s64)capacity);
 	(void)b;	/* unused var warning? */
 
 	/*

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] scsi: lpfc: avoid harmless comparison warning Arnd Bergmann <arnd@arndb.de> - 2016-06-15 22:50 +0200
  [PATCH 2/2] scsi: wd7000: print sector number as 64-bit Arnd Bergmann <arnd@arndb.de> - 2016-06-15 23:00 +0200
    Re: [PATCH 2/2] scsi: wd7000: print sector number as 64-bit "Martin K. Petersen" <martin.petersen@oracle.com> - 2016-06-21 03:20 +0200
      Re: [PATCH 2/2] scsi: wd7000: print sector number as 64-bit Arnd Bergmann <arnd@arndb.de> - 2016-06-21 13:50 +0200
  Re: [PATCH 1/2] scsi: lpfc: avoid harmless comparison warning Johannes Thumshirn <jthumshirn@suse.de> - 2016-06-16 09:40 +0200

csiph-web