All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: drivers/net/ethernet/mellanox/mlx5/core/lib/dm.c:34 mlx5_dm_create() warn: should '(((1))) << (((__builtin_bswap32(((*((dev->caps.hca_cur[15]) + (($expr_0x7fa2b2bb1b40(30)) / 32))))) >> (32 - 8 - (($expr_0x7fa2b2bb20e0(30)) & 31))) & (((1 << 8) - 1))) - (...
Date: Fri, 06 Aug 2021 14:20:17 +0800	[thread overview]
Message-ID: <202108061408.pM1dctIF-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 6217 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   902e7f373fff2476b53824264c12e4e76c7ec02a
commit: d991bb1c8da842a2a0b9dc83b1005e655783f861 include/linux/compiler-gcc.h: sparse can do constant folding of __builtin_bswap*()
date:   3 months ago
:::::: branch date: 11 hours ago
:::::: commit date: 3 months ago
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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/net/ethernet/mellanox/mlx5/core/lib/dm.c:34 mlx5_dm_create() warn: should '(((1))) << (((__builtin_bswap32(((*((dev->caps.hca_cur[15]) + (($expr_0x7fa2b2bb1b40(30)) / 32))))) >> (32 - 8 - (($expr_0x7fa2b2bb20e0(30)) & 31))) & (((1 << 8) - 1))) - (((__builtin_bswap32(((*((dev->caps.hca_cur[15]) + (($expr_0x7fa2b2bb2ea0(30)) / 32))))) >> (32 - 6 - (($expr_0x7fa2b2bb3440(30)) & 31))) & (((1 << 6) - 1)))))' be a 64 bit type?
drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.c:230 mlx5_sf_dev_table_create() warn: should '1 << (((__builtin_bswap32(((*((dev->caps.hca_cur[0]) + (($expr_0x7ff61231a3a0(30)) / 32))))) >> (32 - 8 - (($expr_0x7ff61231a940(30)) & 31))) & (((1 << 8) - 1))) + 12)' be a 64 bit type?

Old smatch warnings:
drivers/net/ethernet/mellanox/mlx5/core/lib/dm.c:46 mlx5_dm_create() warn: should '(((1))) << (((__builtin_bswap32(((*((dev->caps.hca_cur[15]) + (($expr_0x7fa2b2bb59c0(30)) / 32))))) >> (32 - 8 - (($expr_0x7fa2b2bb5f60(30)) & 31))) & (((1 << 8) - 1))) - (((__builtin_bswap32(((*((dev->caps.hca_cur[15]) + (($expr_0x7fa2b2bb6d20(30)) / 32))))) >> (32 - 6 - (($expr_0x7fa2b2bb72c0(30)) & 31))) & (((1 << 6) - 1)))))' be a 64 bit type?

vim +34 drivers/net/ethernet/mellanox/mlx5/core/lib/dm.c

c9b9dcb430b3cd Ariel Levkovich 2019-08-29  16  
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  17  struct mlx5_dm *mlx5_dm_create(struct mlx5_core_dev *dev)
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  18  {
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  19  	u64 header_modify_icm_blocks = 0;
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  20  	u64 steering_icm_blocks = 0;
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  21  	struct mlx5_dm *dm;
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  22  
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  23  	if (!(MLX5_CAP_GEN_64(dev, general_obj_types) & MLX5_GENERAL_OBJ_TYPES_CAP_SW_ICM))
586ee9e8a3b007 Saeed Mahameed  2020-01-22  24  		return NULL;
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  25  
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  26  	dm = kzalloc(sizeof(*dm), GFP_KERNEL);
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  27  	if (!dm)
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  28  		return ERR_PTR(-ENOMEM);
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  29  
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  30  	spin_lock_init(&dm->lock);
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  31  
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  32  	if (MLX5_CAP64_DEV_MEM(dev, steering_sw_icm_start_address)) {
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  33  		steering_icm_blocks =
c9b9dcb430b3cd Ariel Levkovich 2019-08-29 @34  			BIT(MLX5_CAP_DEV_MEM(dev, log_steering_sw_icm_size) -
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  35  			    MLX5_LOG_SW_ICM_BLOCK_SIZE(dev));
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  36  
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  37  		dm->steering_sw_icm_alloc_blocks =
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  38  			kcalloc(BITS_TO_LONGS(steering_icm_blocks),
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  39  				sizeof(unsigned long), GFP_KERNEL);
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  40  		if (!dm->steering_sw_icm_alloc_blocks)
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  41  			goto err_steering;
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  42  	}
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  43  
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  44  	if (MLX5_CAP64_DEV_MEM(dev, header_modify_sw_icm_start_address)) {
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  45  		header_modify_icm_blocks =
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  46  			BIT(MLX5_CAP_DEV_MEM(dev, log_header_modify_sw_icm_size) -
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  47  			    MLX5_LOG_SW_ICM_BLOCK_SIZE(dev));
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  48  
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  49  		dm->header_modify_sw_icm_alloc_blocks =
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  50  			kcalloc(BITS_TO_LONGS(header_modify_icm_blocks),
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  51  				sizeof(unsigned long), GFP_KERNEL);
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  52  		if (!dm->header_modify_sw_icm_alloc_blocks)
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  53  			goto err_modify_hdr;
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  54  	}
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  55  
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  56  	return dm;
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  57  
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  58  err_modify_hdr:
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  59  	kfree(dm->steering_sw_icm_alloc_blocks);
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  60  
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  61  err_steering:
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  62  	kfree(dm);
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  63  
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  64  	return ERR_PTR(-ENOMEM);
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  65  }
c9b9dcb430b3cd Ariel Levkovich 2019-08-29  66  

:::::: The code at line 34 was first introduced by commit
:::::: c9b9dcb430b3cd0ad2b04c360c4e528d73430481 net/mlx5: Move device memory management to mlx5_core

:::::: TO: Ariel Levkovich <lariel@mellanox.com>
:::::: CC: Saeed Mahameed <saeedm@mellanox.com>

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 37675 bytes --]

                 reply	other threads:[~2021-08-06  6:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202108061408.pM1dctIF-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.