提交 40e4c0a4 编写于 作者: A Arnd Bergmann 提交者: Martin K. Petersen

scsi: wd7000: print sector number as 64-bit

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: NArnd Bergmann <arnd@arndb.de>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 540eb1ee
......@@ -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? */
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册