drivers/net/ethernet/mellanox/mlx5/core/en_main.c:339 mlx5e_get_mpwqe_offset() warn: should '(wqe_ix * ((((((((((1))) << (((18 - 12 > 0) ?18 - 12:0))) + 1)) + (((8)) - 1)) & ~(((8)) - 1))))) << 12' be a 64 bit type?

From: Dan Carpenter
Date: Fri Aug 06 2021 - 03:39:33 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 902e7f373fff2476b53824264c12e4e76c7ec02a
commit: d5dd03b26ba49c4ffe67ee1937add82293c19794 net/mlx5e: RX, Mind the MPWQE gaps when calculating offsets
config: i386-randconfig-m021-20210804 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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

smatch warnings:
drivers/net/ethernet/mellanox/mlx5/core/en_main.c:339 mlx5e_get_mpwqe_offset() warn: should '(wqe_ix * ((((((((((1))) << (((18 - 12 > 0) ?18 - 12:0))) + 1)) + (((8)) - 1)) & ~(((8)) - 1))))) << 12' be a 64 bit type?

vim +339 drivers/net/ethernet/mellanox/mlx5/core/en_main.c

d5dd03b26ba49c Tariq Toukan 2021-01-12 337 static u64 mlx5e_get_mpwqe_offset(u16 wqe_ix)
b8a98a4cf3221d Tariq Toukan 2017-12-20 338 {
d5dd03b26ba49c Tariq Toukan 2021-01-12 @339 return MLX5E_REQUIRED_MTTS(wqe_ix) << PAGE_SHIFT;

This function returns u64 but only the lower 32 bits can be set.

b8a98a4cf3221d Tariq Toukan 2017-12-20 340 }

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