LKML Archive on
help / color / mirror / Atom feed
* [PATCH -next] zram: fix printk formats in zram_drv.c
@ 2018-05-03 18:21 Randy Dunlap
  0 siblings, 0 replies; only message in thread
From: Randy Dunlap @ 2018-05-03 18:21 UTC (permalink / raw)
  To: LKML, linux-block, axboe; +Cc: Nitin Gupta, Minchan Kim, Sergey Senozhatsky

From: Randy Dunlap <>

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 <>
Cc: Nitin Gupta <>
Cc: Minchan Kim <>
Cc: Sergey Senozhatsky <>
 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' : '.',

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-05-03 18:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-03 18:21 [PATCH -next] zram: fix printk formats in zram_drv.c Randy Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).