linux-next: build warning after merge of the akpm-current tree
Subsystems (3)
Hi Andrew,
After merging the akpm-current tree, today's linux-next build (x86_64_allmodconfig) produced this warning:
drivers/block/zram/zram_drv.c: In function 'read_block_state':drivers/block/zram/zram_drv.c:674:16: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 5 has type '__kernel_time_t {aka long int}' [-Wformat=]
"%12lu %12llu.%06lu %c%c%c\n",
~~~~~^
%12lu
(unsigned long)index, ts.tv_sec,
~~~~~~~~~Introduced by commit
827c7dbda8eb ("zram-introduce-zram-memory-tracking-update-fix-fix")
Signature · 2 lines
Cheers, Stephen Rothwell
Quoted 13 lines · Stephen Rothwell
Hi Andrew,
After merging the akpm-current tree, today's linux-next build (
x86_64_allmodconfig) produced this warning:
drivers/block/zram/zram_drv.c: In function 'read_block_state':drivers/block/zram/zram_drv.c:674:16: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 5 has type '__kernel_time_t{aka long int}' [-Wformat=]"%12lu %12llu.%06lu %c%c%c\n", ~~~~~^ %12lu (unsigned long)index, ts.tv_sec, ~~~~~~~~~
Quoted 4 lines
Introduced by commit
827c7dbda8eb("zram-introduce-zram-memory-tracking-update-fix-fix")
typedef __s64 time64_t;
struct timespec64 {
time64_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
};time64_t is signed. Also, %lu on i386 et al is for 32-bit longs.
I guess that "we" will need to cast ts.tv_sec to (s64) and use %lld to print it in order to satisfy other $arch.
Andrew, want to add a fix-fix-fix patch?
Signature · 1 line
~Randy
Minchan Kim
maintainerQuoted 26 lines · Randy Dunlap
Quoted 13 lines · Stephen Rothwell
Hi Andrew,
After merging the akpm-current tree, today's linux-next build (
x86_64_allmodconfig) produced this warning:
drivers/block/zram/zram_drv.c: In function 'read_block_state':drivers/block/zram/zram_drv.c:674:16: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 5 has type '__kernel_time_t{aka long int}' [-Wformat=]"%12lu %12llu.%06lu %c%c%c\n", ~~~~~^ %12lu (unsigned long)index, ts.tv_sec, ~~~~~~~~~Quoted 4 lines
Introduced by commit
827c7dbda8eb("zram-introduce-zram-memory-tracking-update-fix-fix")typedef
__s64time64_t;struct timespec64 { time64_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ };
Quoted 5 lines
time64_tis signed. Also, %lu on i386 et al is for 32-bit longs.
I guess that "we" will need to cast ts.tv_sec to (s64) and use %lld to print it in order to satisfy other $arch.Andrew, want to add a fix-fix-fix patch?
Thanks for the fix during I am absent, Andrew and Randy. Here goes fix.
Andrew please fold this patchset.
Quoted 1 line
From
16569c7abb641930b4e4ec66b4dc2005e6c87be8Mon Sep 17 00:00:00 2001
From: Minchan Kim <[email protected]>
Date: Mon, 7 May 2018 23:00:16 +0900
Subject: [PATCH] zram-introduce-zram-memory-tracking-update-fix-fix-fix
fix compile warning
drivers/block/zram/zram_drv.c: In function 'read_block_state':drivers/block/zram/zram_drv.c:674:16: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 5 has type '__kernel_time_t {aka long int}' [-Wformat=]
"%12lu %12llu.%06lu %c%c%c\n",
~~~~~^
%12lu
(unsigned long)index, ts.tv_sec,
~~~~~~~~~--- drivers/block/zram/zram_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/block/zram/zram_drv.c +2 -2
@@ -671,8 +671,8 @@ static ssize_t read_block_state(struct file *file, char __user *buf, ts =ktime_to_timespec64 (zram->table[index].ac_time); copied = snprintf(kbuf + written, count, - "%12lu %12llu.%06lu %c%c%c\n", - (unsigned long)index, ts.tv_sec, + "%12lu %12lld.%06ld %c%c%c\n", + (unsigned long)index, (s64)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' : '.',
Signature · 1 line
2.17.0.441.gb46fe60e1d-goog
Quoted 67 lines · Minchan Kim
Quoted 26 lines · Randy Dunlap
Quoted 13 lines · Stephen Rothwell
Hi Andrew,
After merging the akpm-current tree, today's linux-next build (
x86_64_allmodconfig) produced this warning:
drivers/block/zram/zram_drv.c: In function 'read_block_state':drivers/block/zram/zram_drv.c:674:16: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 5 has type '__kernel_time_t{aka long int}' [-Wformat=]"%12lu %12llu.%06lu %c%c%c\n", ~~~~~^ %12lu (unsigned long)index, ts.tv_sec, ~~~~~~~~~Quoted 4 lines
Introduced by commit
827c7dbda8eb("zram-introduce-zram-memory-tracking-update-fix-fix")typedef
__s64time64_t;struct timespec64 { time64_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ };Quoted 5 lines
time64_tis signed. Also, %lu on i386 et al is for 32-bit longs.
I guess that "we" will need to cast ts.tv_sec to (s64) and use %lld to print it in order to satisfy other $arch.Andrew, want to add a fix-fix-fix patch?
Thanks for the fix during I am absent, Andrew and Randy. Here goes fix.
Andrew please fold this patchset.From
16569c7abb641930b4e4ec66b4dc2005e6c87be8Mon Sep 17 00:00:00 2001
From: Minchan Kim <[email protected]>
Date: Mon, 7 May 2018 23:00:16 +0900
Subject: [PATCH] zram-introduce-zram-memory-tracking-update-fix-fix-fixfix compile warning
drivers/block/zram/zram_drv.c: In function 'read_block_state':drivers/block/zram/zram_drv.c:674:16: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 5 has type '__kernel_time_t{aka long int}' [-Wformat=]"%12lu %12llu.%06lu %c%c%c\n", ~~~~~^ %12lu (unsigned long)index, ts.tv_sec, ~~~~~~~~~Cc Greg Kroah-Hartman <[email protected]>Cc Randy Dunlap <[email protected]>Cc Sergey Senozhatsky <[email protected]>Cc Andrew Morton <[email protected]>Cc Stephen Rothwell <[email protected]>Signed-off-by Minchan Kim <[email protected]>--- drivers/block/zram/zram_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/block/zram/zram_drv.c +0
-0
drivers/block/zram/zram_drv.c static ssize_t read_block_state(struct file *file, char __user *buf, · line 678
Quoted 10 lines
drivers/block/zram/zram_drv.c +2
-2@@ -671,8 +671,8 @@ static ssize_t read_block_state(struct file *file, char __user *buf, ts =ktime_to_timespec64 (zram->table[index].ac_time); copied = snprintf(kbuf + written, count, - "%12lu %12llu.%06lu %c%c%c\n", - (unsigned long)index, ts.tv_sec, + "%12lu %12lld.%06ld %c%c%c\n", + (unsigned long)index, (s64)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' : '.',
ssize_t index,
so why not print it with %zd (or %12zd) and skip the cast?
Signature · 1 line
~Randy
Minchan Kim
maintainerQuoted 81 lines · Randy Dunlap
Quoted 67 lines · Minchan Kim
Quoted 26 lines · Randy Dunlap
Quoted 13 lines · Stephen Rothwell
Hi Andrew,
After merging the akpm-current tree, today's linux-next build (
x86_64_allmodconfig) produced this warning:
drivers/block/zram/zram_drv.c: In function 'read_block_state':drivers/block/zram/zram_drv.c:674:16: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 5 has type '__kernel_time_t{aka long int}' [-Wformat=]"%12lu %12llu.%06lu %c%c%c\n", ~~~~~^ %12lu (unsigned long)index, ts.tv_sec, ~~~~~~~~~Quoted 4 lines
Introduced by commit
827c7dbda8eb("zram-introduce-zram-memory-tracking-update-fix-fix")typedef
__s64time64_t;struct timespec64 { time64_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ };Quoted 5 lines
time64_tis signed. Also, %lu on i386 et al is for 32-bit longs.
I guess that "we" will need to cast ts.tv_sec to (s64) and use %lld to print it in order to satisfy other $arch.Andrew, want to add a fix-fix-fix patch?
Thanks for the fix during I am absent, Andrew and Randy. Here goes fix.
Andrew please fold this patchset.From
16569c7abb641930b4e4ec66b4dc2005e6c87be8Mon Sep 17 00:00:00 2001
From: Minchan Kim <[email protected]>
Date: Mon, 7 May 2018 23:00:16 +0900
Subject: [PATCH] zram-introduce-zram-memory-tracking-update-fix-fix-fixfix compile warning
drivers/block/zram/zram_drv.c: In function 'read_block_state':drivers/block/zram/zram_drv.c:674:16: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 5 has type '__kernel_time_t{aka long int}' [-Wformat=]"%12lu %12llu.%06lu %c%c%c\n", ~~~~~^ %12lu (unsigned long)index, ts.tv_sec, ~~~~~~~~~Cc Greg Kroah-Hartman <[email protected]>Cc Randy Dunlap <[email protected]>Cc Sergey Senozhatsky <[email protected]>Cc Andrew Morton <[email protected]>Cc Stephen Rothwell <[email protected]>Signed-off-by Minchan Kim <[email protected]>--- drivers/block/zram/zram_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/block/zram/zram_drv.c +0
-0drivers/block/zram/zram_drv.c static ssize_t read_block_state(struct file *file, char __user *buf, · line 678
Quoted 10 lines
drivers/block/zram/zram_drv.c +2
-2@@ -671,8 +671,8 @@ static ssize_t read_block_state(struct file *file, char __user *buf, ts =ktime_to_timespec64 (zram->table[index].ac_time); copied = snprintf(kbuf + written, count, - "%12lu %12llu.%06lu %c%c%c\n", - (unsigned long)index, ts.tv_sec, + "%12lu %12lld.%06ld %c%c%c\n", + (unsigned long)index, (s64)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' : '.',
ssize_tindex,
Quoted 1 line
so why not print it with %zd (or %12zd) and skip the cast?
Thanks for the suggestion.
Resend.
Andrew, Could you pick up this?
Quoted 1 line
From
8af033804a8a7a0538629545957728c48d14d261Mon Sep 17 00:00:00 2001
From: Minchan Kim <[email protected]>
Date: Mon, 7 May 2018 23:00:16 +0900
Subject: [PATCH] zram-introduce-zram-memory-tracking-update-fix-fix-fix
fix compile warning and use zd for ssize_t by Randy's suggestion.
drivers/block/zram/zram_drv.c: In function 'read_block_state':drivers/block/zram/zram_drv.c:674:16: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 5 has type '__kernel_time_t {aka long int}' [-Wformat=]
"%12lu %12llu.%06lu %c%c%c\n",
~~~~~^
%12lu
(unsigned long)index, ts.tv_sec,
~~~~~~~~~--- drivers/block/zram/zram_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/block/zram/zram_drv.c +2 -2
@@ -671,8 +671,8 @@ static ssize_t read_block_state(struct file *file, char __user *buf, ts =ktime_to_timespec64 (zram->table[index].ac_time); copied = snprintf(kbuf + written, count, - "%12lu %12llu.%06lu %c%c%c\n", - (unsigned long)index, ts.tv_sec, + "%12zd %12lld.%06ld %c%c%c\n", + index, (s64)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' : '.',
Signature · 1 line
2.17.0.441.gb46fe60e1d-goog