Messages in this thread | | | Date | Mon, 6 Nov 2023 08:50:38 +0800 | From | Philip Li <> | Subject | Re: net/ceph/osdmap.c:1246:10: warning: result of comparison of constant 4611686018427387891 with expression of type 'u32' (aka 'unsigned int') is always false |
| |
On Mon, Nov 06, 2023 at 07:13:50AM +0800, kernel test robot wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > head: 77fa2fbe87fc605c4bfa87dff87be9bfded0e9a3 > commit: afe956c577b2d5a3d9834e4424587c1ebcf90c4c kbuild: Enable -Wtautological-compare > date: 3 years, 7 months ago > config: x86_64-randconfig-012-20230909 (https://download.01.org/0day-ci/archive/20231106/202311060731.8P11QmUf-lkp@intel.com/config) > compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07) > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231106/202311060731.8P11QmUf-lkp@intel.com/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@intel.com> > | Closes: https://lore.kernel.org/oe-kbuild-all/202311060731.8P11QmUf-lkp@intel.com/ > > All warnings (new ones prefixed by >>):
Sorry for wrong report, kindly ignore this, it bisects to wrong commit that is not the real cause.
> > net/ceph/osdmap.c:176:6: warning: no previous prototype for function 'clear_choose_args' [-Wmissing-prototypes] > void clear_choose_args(struct crush_map *c) > ^ > net/ceph/osdmap.c:176:1: note: declare 'static' if the function is not intended to be used outside of this translation unit > void clear_choose_args(struct crush_map *c) > ^ > static > >> net/ceph/osdmap.c:1246:10: warning: result of comparison of constant 4611686018427387891 with expression of type 'u32' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare] > if (len > (SIZE_MAX - sizeof(*pg)) / sizeof(u32)) > ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > net/ceph/osdmap.c:1429:10: warning: result of comparison of constant 2305843009213693945 with expression of type 'u32' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare] > if (len > (SIZE_MAX - sizeof(*pg)) / (2 * sizeof(u32))) > ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 3 warnings generated. > -- > >> drivers/block/rbd.c:6190:17: warning: result of comparison of constant 2305843009213693948 with expression of type 'u32' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare] > if (snap_count > (SIZE_MAX - sizeof (struct ceph_snap_context)) > ~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 1 warning generated. > > > vim +1246 net/ceph/osdmap.c > > 10db634e2083a2 Ilya Dryomov 2014-03-21 1236 > a303bb0e58345f Ilya Dryomov 2017-06-21 1237 static struct ceph_pg_mapping *__decode_pg_temp(void **p, void *end, > a303bb0e58345f Ilya Dryomov 2017-06-21 1238 bool incremental) > a303bb0e58345f Ilya Dryomov 2017-06-21 1239 { > a303bb0e58345f Ilya Dryomov 2017-06-21 1240 struct ceph_pg_mapping *pg; > a303bb0e58345f Ilya Dryomov 2017-06-21 1241 u32 len, i; > a303bb0e58345f Ilya Dryomov 2017-06-21 1242 > a303bb0e58345f Ilya Dryomov 2017-06-21 1243 ceph_decode_32_safe(p, end, len, e_inval); > a303bb0e58345f Ilya Dryomov 2017-06-21 1244 if (len == 0 && incremental) > a303bb0e58345f Ilya Dryomov 2017-06-21 1245 return NULL; /* new_pg_temp: [] to remove */ > a303bb0e58345f Ilya Dryomov 2017-06-21 @1246 if (len > (SIZE_MAX - sizeof(*pg)) / sizeof(u32)) > a303bb0e58345f Ilya Dryomov 2017-06-21 1247 return ERR_PTR(-EINVAL); > a303bb0e58345f Ilya Dryomov 2017-06-21 1248 > a303bb0e58345f Ilya Dryomov 2017-06-21 1249 ceph_decode_need(p, end, len * sizeof(u32), e_inval); > a303bb0e58345f Ilya Dryomov 2017-06-21 1250 pg = alloc_pg_mapping(len * sizeof(u32)); > 10db634e2083a2 Ilya Dryomov 2014-03-21 1251 if (!pg) > a303bb0e58345f Ilya Dryomov 2017-06-21 1252 return ERR_PTR(-ENOMEM); > 10db634e2083a2 Ilya Dryomov 2014-03-21 1253 > 35a935d75d51ab Ilya Dryomov 2014-03-21 1254 pg->pg_temp.len = len; > 10db634e2083a2 Ilya Dryomov 2014-03-21 1255 for (i = 0; i < len; i++) > 35a935d75d51ab Ilya Dryomov 2014-03-21 1256 pg->pg_temp.osds[i] = ceph_decode_32(p); > 10db634e2083a2 Ilya Dryomov 2014-03-21 1257 > a303bb0e58345f Ilya Dryomov 2017-06-21 1258 return pg; > 10db634e2083a2 Ilya Dryomov 2014-03-21 1259 > 10db634e2083a2 Ilya Dryomov 2014-03-21 1260 e_inval: > a303bb0e58345f Ilya Dryomov 2017-06-21 1261 return ERR_PTR(-EINVAL); > 10db634e2083a2 Ilya Dryomov 2014-03-21 1262 } > 10db634e2083a2 Ilya Dryomov 2014-03-21 1263 > > :::::: The code at line 1246 was first introduced by commit > :::::: a303bb0e58345fe9f7ab2f82b90266f2b5036058 libceph: introduce and switch to decode_pg_mapping() > > :::::: TO: Ilya Dryomov <idryomov@gmail.com> > :::::: CC: Ilya Dryomov <idryomov@gmail.com> > > -- > 0-DAY CI Kernel Test Service > https://github.com/intel/lkp-tests/wiki
| |