[kbuild] 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 Thread Dan Carpenter
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 
Reported-by: Dan Carpenter 

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 Vadai2016-05-13 @1545  if (dest && (dest->type 
== MLX5_FLOW_DESTINATION_TYPE_COUNTER))

Check for NULL.

171c7625bef9998 Mark Bloch2018-10-03  1546  return 
counter_is_valid(action);
bd5251dbf156b6b Amir Vadai2016-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-...@lists.01.org


.config.gz
Description: application/gzip
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] 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 Thread kernel test robot
CC: kbuild-...@lists.01.org
CC: linux-ker...@vger.kernel.org
TO: Paul Blakey 
CC: Saeed Mahameed 
CC: Mark Bloch 

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
date:   8 months ago
:: branch date: 12 hours ago
:: commit date: 8 months ago
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 
Reported-by: Dan Carpenter 

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)

# 
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

bd5251dbf156b6b Amir Vadai2016-05-13  1537  
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 Vadai2016-05-13 @1545  if (dest && (dest->type 
== MLX5_FLOW_DESTINATION_TYPE_COUNTER))
171c7625bef9998 Mark Bloch2018-10-03  1546  return 
counter_is_valid(action);
bd5251dbf156b6b Amir Vadai2016-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 &&
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 ==
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  }
d63cd28608bb563 Maor Gottlieb 2016-04-29  1566  

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


.config.gz
Description: application/gzip
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org