linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/net/ethernet/mellanox/mlx5/core/fs_core.c:1555 dest_is_valid() error: we previously assumed 'dest' could be null (see line 1545)
@ 2020-09-11 10:34 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2020-09-11 10:34 UTC (permalink / raw)
  To: kbuild, Paul Blakey
  Cc: lkp, kbuild-all, linux-kernel, Saeed Mahameed, Mark Bloch

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   581cb3a26baf846ee9636214afaa5333919875b1
commit: ff189b43568216c6211e9e7ddd9026cb8295e744 net/mlx5: Add ignore level support fwd to table rules
config: powerpc-randconfig-m031-20200911 (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 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/fs_core.c:1555 dest_is_valid() error: we previously assumed 'dest' could be null (see line 1545)

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ff189b43568216c6211e9e7ddd9026cb8295e744
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout ff189b43568216c6211e9e7ddd9026cb8295e744
vim +/dest +1555 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c

d63cd28608bb563 Maor Gottlieb 2016-04-29  1538  static bool dest_is_valid(struct mlx5_flow_destination *dest,
ff189b43568216c Paul Blakey   2020-01-05  1539  			  struct mlx5_flow_act *flow_act,
d63cd28608bb563 Maor Gottlieb 2016-04-29  1540  			  struct mlx5_flow_table *ft)
d63cd28608bb563 Maor Gottlieb 2016-04-29  1541  {
ff189b43568216c Paul Blakey   2020-01-05  1542  	bool ignore_level = flow_act->flags & FLOW_ACT_IGNORE_FLOW_LEVEL;
ff189b43568216c Paul Blakey   2020-01-05  1543  	u32 action = flow_act->action;
ff189b43568216c Paul Blakey   2020-01-05  1544  
bd5251dbf156b6b Amir Vadai    2016-05-13 @1545  	if (dest && (dest->type == MLX5_FLOW_DESTINATION_TYPE_COUNTER))
                                                            ^^^^
Check for NULL.

171c7625bef9998 Mark Bloch    2018-10-03  1546  		return counter_is_valid(action);
bd5251dbf156b6b Amir Vadai    2016-05-13  1547  
d63cd28608bb563 Maor Gottlieb 2016-04-29  1548  	if (!(action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST))
d63cd28608bb563 Maor Gottlieb 2016-04-29  1549  		return true;
d63cd28608bb563 Maor Gottlieb 2016-04-29  1550  
ff189b43568216c Paul Blakey   2020-01-05  1551  	if (ignore_level) {
ff189b43568216c Paul Blakey   2020-01-05  1552  		if (ft->type != FS_FT_FDB)
ff189b43568216c Paul Blakey   2020-01-05  1553  			return false;
ff189b43568216c Paul Blakey   2020-01-05  1554  
ff189b43568216c Paul Blakey   2020-01-05 @1555  		if (dest->type == MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE &&
                                                                    ^^^^^^^^^^
Unchecked dereference.

ff189b43568216c Paul Blakey   2020-01-05  1556  		    dest->ft->type != FS_FT_FDB)
ff189b43568216c Paul Blakey   2020-01-05  1557  			return false;
ff189b43568216c Paul Blakey   2020-01-05  1558  	}
ff189b43568216c Paul Blakey   2020-01-05  1559  
d63cd28608bb563 Maor Gottlieb 2016-04-29  1560  	if (!dest || ((dest->type ==
                                                            ^^^^^
Check.

d63cd28608bb563 Maor Gottlieb 2016-04-29  1561  	    MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE) &&
ff189b43568216c Paul Blakey   2020-01-05  1562  	    (dest->ft->level <= ft->level && !ignore_level)))
d63cd28608bb563 Maor Gottlieb 2016-04-29  1563  		return false;
d63cd28608bb563 Maor Gottlieb 2016-04-29  1564  	return true;
d63cd28608bb563 Maor Gottlieb 2016-04-29  1565  }

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

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* drivers/net/ethernet/mellanox/mlx5/core/fs_core.c:1555 dest_is_valid() error: we previously assumed 'dest' could be null (see line 1545)
@ 2020-08-14  1:06 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2020-08-14  1:06 UTC (permalink / raw)
  To: Paul Blakey; +Cc: kbuild-all, linux-kernel, Saeed Mahameed, Mark Bloch

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   dddcbc139e96bd18d8c65ef7b7e440f0d32457c2
commit: ff189b43568216c6211e9e7ddd9026cb8295e744 net/mlx5: Add ignore level support fwd to table rules
date:   7 months ago
config: ia64-randconfig-m031-20200811 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

New smatch warnings:
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c:1555 dest_is_valid() error: we previously assumed 'dest' could be null (see line 1545)

Old smatch warnings:
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c:1818 _mlx5_add_flow_rules() error: double unlocked 'ft->node.lock' (orig line 1810)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c:1834 _mlx5_add_flow_rules() error: double unlocked 'ft->node.lock' (orig line 1810)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c:1840 _mlx5_add_flow_rules() error: double unlocked 'ft->node.lock' (orig line 1810)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c:1846 _mlx5_add_flow_rules() error: double unlocked 'ft->node.lock' (orig line 1810)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c:1859 _mlx5_add_flow_rules() error: double unlocked 'fte->node.lock' (orig line 1857)

vim +/dest +1555 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c

  1537	
  1538	static bool dest_is_valid(struct mlx5_flow_destination *dest,
  1539				  struct mlx5_flow_act *flow_act,
  1540				  struct mlx5_flow_table *ft)
  1541	{
  1542		bool ignore_level = flow_act->flags & FLOW_ACT_IGNORE_FLOW_LEVEL;
  1543		u32 action = flow_act->action;
  1544	
> 1545		if (dest && (dest->type == MLX5_FLOW_DESTINATION_TYPE_COUNTER))
  1546			return counter_is_valid(action);
  1547	
  1548		if (!(action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST))
  1549			return true;
  1550	
  1551		if (ignore_level) {
  1552			if (ft->type != FS_FT_FDB)
  1553				return false;
  1554	
> 1555			if (dest->type == MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE &&
  1556			    dest->ft->type != FS_FT_FDB)
  1557				return false;
  1558		}
  1559	
  1560		if (!dest || ((dest->type ==
  1561		    MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE) &&
  1562		    (dest->ft->level <= ft->level && !ignore_level)))
  1563			return false;
  1564		return true;
  1565	}
  1566	

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

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-11 10:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-11 10:34 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c:1555 dest_is_valid() error: we previously assumed 'dest' could be null (see line 1545) Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2020-08-14  1:06 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).