arch/um/drivers/vector_kern.c:146:39: warning: ordered comparison of pointer with integer zero

From: kernel test robot
Date: Wed Jan 31 2024 - 11:49:04 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 1bbb19b6eb1b8685ab1c268a401ea64380b8bbcb
commit: 9807019a62dc670c73ce8e59e09b41ae458c34b3 um: Loadable BPF "Firmware" for vector drivers
date: 4 years, 2 months ago
config: um-randconfig-r063-20240107 (https://download.01.org/0day-ci/archive/20240201/202402010040.RUSVaes4-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240201/202402010040.RUSVaes4-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402010040.RUSVaes4-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

cc1: warning: arch/um/include/uapi: No such file or directory [-Wmissing-include-dirs]
In file included from include/linux/init.h:5,
from include/linux/memblock.h:12,
from arch/um/drivers/vector_kern.c:12:
include/asm-generic/fixmap.h: In function 'fix_to_virt':
include/asm-generic/fixmap.h:32:26: warning: comparison of unsigned expression in '>= 0' is always true [-Wtype-limits]
32 | BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
| ^~
include/linux/compiler.h:330:23: note: in definition of macro '__compiletime_assert'
330 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler.h:350:9: note: in expansion of macro '_compiletime_assert'
350 | _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
include/asm-generic/fixmap.h:32:9: note: in expansion of macro 'BUILD_BUG_ON'
32 | BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
| ^~~~~~~~~~~~
In file included from include/linux/uaccess.h:11,
from include/linux/crypto.h:21,
from include/crypto/hash.h:11,
from include/linux/uio.h:10,
from include/linux/socket.h:8,
from include/linux/skbuff.h:20,
from include/linux/if_ether.h:19,
from include/linux/etherdevice.h:20,
from arch/um/drivers/vector_kern.c:13:
arch/um/include/asm/uaccess.h: In function '__access_ok':
arch/um/include/asm/uaccess.h:17:36: warning: comparison of unsigned expression in '>= 0' is always true [-Wtype-limits]
17 | (((unsigned long) (addr) >= FIXADDR_USER_START) && \
| ^~
arch/um/include/asm/uaccess.h:45:17: note: in expansion of macro '__access_ok_vsyscall'
45 | __access_ok_vsyscall(addr, size) ||
| ^~~~~~~~~~~~~~~~~~~~
arch/um/drivers/vector_kern.c: In function 'get_bpf_flash':
>> arch/um/drivers/vector_kern.c:146:39: warning: ordered comparison of pointer with integer zero [-Wextra]
146 | return (allow > 0);
| ^
arch/um/drivers/vector_kern.c: In function 'vector_parse':
arch/um/drivers/vector_kern.c:717:16: warning: variable 'len' set but not used [-Wunused-but-set-variable]
717 | int n, len, err;
| ^~~


vim +146 arch/um/drivers/vector_kern.c

138
139 static bool get_bpf_flash(struct arglist *def)
140 {
141 char *allow = uml_vector_fetch_arg(def, "bpfflash");
142 long result;
143
144 if (allow != NULL) {
145 if (kstrtoul(allow, 10, &result) == 0)
> 146 return (allow > 0);
147 }
148 return false;
149 }
150

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki