summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Graul <kgraul@linux.ibm.com>2020-11-18 22:40:38 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-11-24 13:28:58 +0100
commit9e909956d0c758c35c9a58fc00c4e1c3b323485f (patch)
treeeb7789f5add7345be22b8625fb096526564b408b
parentab1e4b3c406b588d5fe5a3e56b3ba54359881ead (diff)
downloadlinux-stable-9e909956d0c758c35c9a58fc00c4e1c3b323485f.tar.gz
linux-stable-9e909956d0c758c35c9a58fc00c4e1c3b323485f.tar.bz2
linux-stable-9e909956d0c758c35c9a58fc00c4e1c3b323485f.zip
net/smc: fix direct access to ib_gid_addr->ndev in smc_ib_determine_gid()
[ Upstream commit 41a0be3f8f6be893860b991eb10c47fc3ee09d7f ] Sparse complaints 3 times about: net/smc/smc_ib.c:203:52: warning: incorrect type in argument 1 (different address spaces) net/smc/smc_ib.c:203:52: expected struct net_device const *dev net/smc/smc_ib.c:203:52: got struct net_device [noderef] __rcu *const ndev Fix that by using the existing and validated ndev variable instead of accessing attr->ndev directly. Fixes: 5102eca9039b ("net/smc: Use rdma_read_gid_l2_fields to L2 fields") Signed-off-by: Karsten Graul <kgraul@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/smc/smc_ib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c
index d74a71dff5b8..a2bc7e096ef8 100644
--- a/net/smc/smc_ib.c
+++ b/net/smc/smc_ib.c
@@ -191,9 +191,9 @@ int smc_ib_determine_gid(struct smc_ib_device *smcibdev, u8 ibport,
rcu_read_lock();
ndev = rdma_read_gid_attr_ndev_rcu(attr);
if (!IS_ERR(ndev) &&
- ((!vlan_id && !is_vlan_dev(attr->ndev)) ||
- (vlan_id && is_vlan_dev(attr->ndev) &&
- vlan_dev_vlan_id(attr->ndev) == vlan_id)) &&
+ ((!vlan_id && !is_vlan_dev(ndev)) ||
+ (vlan_id && is_vlan_dev(ndev) &&
+ vlan_dev_vlan_id(ndev) == vlan_id)) &&
attr->gid_type == IB_GID_TYPE_ROCE) {
rcu_read_unlock();
if (gid)