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

From: kernel test robot
Date: Thu Aug 13 2020 - 21:32:50 EST


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@xxxxxxxxx>

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@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip