All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: drivers/net/ethernet/mellanox/mlx5/core/fs_core.c:1555 dest_is_valid() error: we previously assumed 'dest' could be null (see line 1545)
Date: Fri, 11 Sep 2020 13:34:26 +0300	[thread overview]
Message-ID: <20200911103426.GH12635@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 3558 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(a)lists.01.org

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

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: drivers/net/ethernet/mellanox/mlx5/core/fs_core.c:1555 dest_is_valid() error: we previously assumed 'dest' could be null (see line 1545)
Date: Fri, 11 Sep 2020 13:34:26 +0300	[thread overview]
Message-ID: <20200911103426.GH12635@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 3558 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(a)lists.01.org

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

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Paul Blakey <paulb@mellanox.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org,
	Saeed Mahameed <saeedm@mellanox.com>,
	Mark Bloch <markb@mellanox.com>
Subject: drivers/net/ethernet/mellanox/mlx5/core/fs_core.c:1555 dest_is_valid() error: we previously assumed 'dest' could be null (see line 1545)
Date: Fri, 11 Sep 2020 13:34:26 +0300	[thread overview]
Message-ID: <20200911103426.GH12635@kadam> (raw)

[-- 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 --]

             reply	other threads:[~2020-09-11 10:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-11 10:34 Dan Carpenter [this message]
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
2020-09-11 10:34 ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2020-09-11  7:45 kernel test robot
2020-08-14  1:06 kernel test robot
2020-08-14  1:06 ` kernel test robot

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=20200911103426.GH12635@kadam \
    --to=dan.carpenter@oracle.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.