thrashing on format %u vs size_t arg

jim.cromie at gmail.com jim.cromie at gmail.com
Tue Sep 14 11:32:33 EDT 2021


wrt:

+       v2pr_info("read %u bytes from userspace <\n%s>\n", len, tmpbuf);

Im getting what appears to be conflicting warnings
about %u vs unsigned int (sometimes unsigned long int)
depending upon platform ??

Ive now tried both  %lu  and  %u

What have I missed ?




[jimc:dd-drm-next 3/16] lib/dynamic_debug.c:786:53: warning: format
specifies type 'unsigned int' but the argument has type 'size_t' (aka
'unsigned long')

head:   bf8f0832d11f09c546179ca6a2c5432706ea3d32



[kbuild-all] [jimc:dd-drm-next 3/16] include/linux/kern_levels.h:5:25:
warning: format '%u' expects argument of type 'unsigned int', but
argument 2 has type 'size_t' {aka 'long unsigned int'}

Inbox
Linux/kbuild-all
to-me

kernel test robot via lists.01.org

Mon, Sep 13, 9:08 PM (11 hours ago)
to me, kbuild-all
tree:   https://github.com/jimc/linux.git dd-drm-next
head:   bf8f0832d11f09c546179ca6a2c5432706ea3d32
commit: 221a341c10ebb8545beac6ee3937859d26ddcc60 [3/16] dyndbg:
rationalize verbosity
config: alpha-allyesconfig (attached as .config)


kernel test robot

Sep 13, 2021, 5:45 AM (1 day ago)
to me
tree/branch: https://github.com/jimc/linux.git dd-drm-next
branch HEAD: 02a6c357b6a5eb02cc6b2ceb5a7a93c809388ae0  nouveau: fold
multiple DRM_DEBUG_DRIVERs together

Error/Warning in current branch:

lib/dynamic_debug.c:786:54: warning: format specifies type 'unsigned
long' but the argument has type 'size_t' (aka 'unsigned int')
[-Wformat]
lib/dynamic_debug.c:864:54: warning: format specifies type 'unsigned
long' but the argument has type 'size_t' (aka 'unsigned int')
[-Wformat]
lib/dynamic_debug.c:876:54: warning: format specifies type 'unsigned
long' but the argument has type 'size_t' (aka 'unsigned int')
[-Wformat]


[jimc:dd-drm-next 3/16] lib/dynamic_debug.c:786:54: warning: format
specifies type 'unsigned long' but the argument has type 'size_t' (aka
'unsigned int')

Inbox
Linux/kbuild-all
to-me

kernel test robot

Sep 11, 2021, 5:17 PM (3 days ago)
to me, kbuild-all
tree:   https://github.com/jimc/linux.git dd-drm-next
head:   02a6c357b6a5eb02cc6b2ceb5a7a93c809388ae0
commit: 74992de06222ed51caed07800e291e68eb4a627e [3/16] dyndbg:
rationalize verbosity
config: hexagon-randconfig-r034-20210911 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project
261cbe98c38f8c1ee1a482fe76511110e790f58a)



More information about the Kernelnewbies mailing list