Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1427488 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2016-06-21 11:10 +0200 |
| Last post | 2016-06-22 04:30 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH v2] scsi: wd7000: print sector number as 64-bit Arnd Bergmann <arnd@arndb.de> - 2016-06-21 11:10 +0200
Re: [PATCH v2] scsi: wd7000: print sector number as 64-bit Joe Perches <joe@perches.com> - 2016-06-21 11:20 +0200
Re: [PATCH v2] scsi: wd7000: print sector number as 64-bit "Martin K. Petersen" <martin.petersen@oracle.com> - 2016-06-22 04:30 +0200
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-06-21 11:10 +0200 |
| Subject | [PATCH v2] scsi: wd7000: print sector number as 64-bit |
| Message-ID | <rMpQZ-3Mw-7@gated-at.bofh.it> |
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>
---
v2: use %llu instead of %lld and use 'u64' instead of 's64' because
sector_t is unsigned.
drivers/scsi/wd7000.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c
index 0c0f17b9a3eb..409f959845c4 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=%llu, ",
+ bdevname(bdev, b), (u64)capacity);
(void)b; /* unused var warning? */
/*
--
2.9.0
[toc] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2016-06-21 11:20 +0200 |
| Message-ID | <rMq0F-3PM-7@gated-at.bofh.it> |
| In reply to | #1427488 |
On Tue, 2016-06-21 at 11:02 +0200, Arnd Bergmann wrote: > Enabling format checking in dprintk() shows that wd7000_biosparam > uses an incorrect format string for sector_t: trivia: > diff --git 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 It'd be nicer if both defines were the same form #ifdef WD7000_DEBUG #define dprintk printk #else #define dprintk no_printk #endif
[toc] | [prev] | [next] | [standalone]
| From | "Martin K. Petersen" <martin.petersen@oracle.com> |
|---|---|
| Date | 2016-06-22 04:30 +0200 |
| Message-ID | <rMG5r-5Ol-1@gated-at.bofh.it> |
| In reply to | #1427488 |
>>>>> "Arnd" == Arnd Bergmann <arnd@arndb.de> writes: Arnd> Enabling format checking in dprintk() shows that wd7000_biosparam Arnd> uses an incorrect format string for sector_t: Applied to 4.8/scsi-queue. -- Martin K. Petersen Oracle Linux Engineering
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web