[PATCH -next] zram: fix printk formats in zram_drv.c
From: Randy Dunlap
Date: Thu May 03 2018 - 14:21:14 EST
From: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
Fix printk format warnings (seen on i386 build):
../drivers/block/zram/zram_drv.c:678:4: warning: format â%luâ expects argument of type âlong unsigned intâ, but argument 4 has type âssize_tâ [-Wformat=]
../drivers/block/zram/zram_drv.c:678:4: warning: format â%luâ expects argument of type âlong unsigned intâ, but argument 5 has type âtime64_tâ [-Wformat=]
time64_t is 64 bits (and signed), so printing it should use %lld,
not %ld. %ld (long) is only 32 bits on several architectures.
Signed-off-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
Cc: Nitin Gupta <ngupta@xxxxxxxxxx>
Cc: Minchan Kim <minchan@xxxxxxxxxx>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@xxxxxxxxx>
---
drivers/block/zram/zram_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- linux-next-20180503.orig/drivers/block/zram/zram_drv.c
+++ linux-next-20180503/drivers/block/zram/zram_drv.c
@@ -671,7 +671,7 @@ static ssize_t read_block_state(struct f
ts = ktime_to_timespec64(zram->table[index].ac_time);
copied = snprintf(kbuf + written, count,
- "%12lu %12lu.%06lu %c%c%c\n",
+ "%12zd %12lld.%06lu %c%c%c\n",
index, ts.tv_sec, ts.tv_nsec / NSEC_PER_USEC,
zram_test_flag(zram, index, ZRAM_SAME) ? 's' : '.',
zram_test_flag(zram, index, ZRAM_WB) ? 'w' : '.',