[bvanassche:configfs 6/6] include/linux/kern_levels.h:5:18: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'ssize_t' {aka 'int'}

From: kernel test robot
Date: Fri Jul 23 2021 - 04:30:03 EST


tree: https://github.com/bvanassche/linux configfs
head: 7e2353f58cd57892a51ad80a600b481b22ef775a
commit: 7e2353f58cd57892a51ad80a600b481b22ef775a [6/6] wip2
config: i386-allyesconfig (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
reproduce (this is a W=1 build):
# https://github.com/bvanassche/linux/commit/7e2353f58cd57892a51ad80a600b481b22ef775a
git remote add bvanassche https://github.com/bvanassche/linux
git fetch --no-tags bvanassche configfs
git checkout 7e2353f58cd57892a51ad80a600b481b22ef775a
# save the attached .config to linux build tree
make W=1 ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

In file included from include/linux/printk.h:7,
from include/linux/kernel.h:19,
from include/linux/list.h:9,
from include/linux/wait.h:7,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from fs/configfs/file.c:11:
fs/configfs/file.c: In function 'configfs_bin_write_iter':
include/linux/kern_levels.h:5:18: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
5 | #define KERN_SOH "\001" /* ASCII Start Of Header */
| ^~~~~~
include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
14 | #define KERN_INFO KERN_SOH "6" /* informational */
| ^~~~~~~~
include/linux/printk.h:420:9: note: in expansion of macro 'KERN_INFO'
420 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~
fs/configfs/file.c:289:2: note: in expansion of macro 'pr_info'
289 | pr_info("%s: end_offset = %ld; len = %ld\n", __func__, end_offset, len);
| ^~~~~~~
>> include/linux/kern_levels.h:5:18: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'ssize_t' {aka 'int'} [-Wformat=]
5 | #define KERN_SOH "\001" /* ASCII Start Of Header */
| ^~~~~~
include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
14 | #define KERN_INFO KERN_SOH "6" /* informational */
| ^~~~~~~~
include/linux/printk.h:420:9: note: in expansion of macro 'KERN_INFO'
420 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~
fs/configfs/file.c:289:2: note: in expansion of macro 'pr_info'
289 | pr_info("%s: end_offset = %ld; len = %ld\n", __func__, end_offset, len);
| ^~~~~~~


vim +5 include/linux/kern_levels.h

314ba3520e513a Joe Perches 2012-07-30 4
04d2c8c83d0e3a Joe Perches 2012-07-30 @5 #define KERN_SOH "\001" /* ASCII Start Of Header */
04d2c8c83d0e3a Joe Perches 2012-07-30 6 #define KERN_SOH_ASCII '\001'
04d2c8c83d0e3a Joe Perches 2012-07-30 7
04d2c8c83d0e3a Joe Perches 2012-07-30 8 #define KERN_EMERG KERN_SOH "0" /* system is unusable */
04d2c8c83d0e3a Joe Perches 2012-07-30 9 #define KERN_ALERT KERN_SOH "1" /* action must be taken immediately */
04d2c8c83d0e3a Joe Perches 2012-07-30 10 #define KERN_CRIT KERN_SOH "2" /* critical conditions */
04d2c8c83d0e3a Joe Perches 2012-07-30 11 #define KERN_ERR KERN_SOH "3" /* error conditions */
04d2c8c83d0e3a Joe Perches 2012-07-30 12 #define KERN_WARNING KERN_SOH "4" /* warning conditions */
04d2c8c83d0e3a Joe Perches 2012-07-30 13 #define KERN_NOTICE KERN_SOH "5" /* normal but significant condition */
04d2c8c83d0e3a Joe Perches 2012-07-30 @14 #define KERN_INFO KERN_SOH "6" /* informational */
04d2c8c83d0e3a Joe Perches 2012-07-30 15 #define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
04d2c8c83d0e3a Joe Perches 2012-07-30 16

:::::: The code at line 5 was first introduced by commit
:::::: 04d2c8c83d0e3ac5f78aeede51babb3236200112 printk: convert the format for KERN_<LEVEL> to a 2 byte pattern

:::::: TO: Joe Perches <joe@xxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip