Skip to contentSkip to conversation

nes: uninitialized variable

DISCUSSION Stephen Hemminger 3 participants 3 messages Mar 25, 2011 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

This commit:
commit 2a4c97ead4b375a64063523210939b87ad225b85

Author: Maciej Sosnowski <[email protected]>
Date:   Wed Nov 24 17:29:30 2010 +0000

RDMA/nes: Fix bonding on iw_nes

Enable configuring bonds on nes devices by adding missing support for master net_device to the driver.

introduced:
drivers/infiniband/hw/nes/nes_cm.c: In function ‘nes_addr_resolve_neigh’:
include/linux/netdevice.h:2586: warning: ‘netdev’ may be used uninitialized in this function drivers/infiniband/hw/nes/nes_cm.c:1109: note: ‘netdev’ was declared here

here:
static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpindex)

{
	struct net_device *netdev;
	struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter;

	rt = ip_route_output(&init_net, htonl(dst_ip), 0, 0, 0);
	if (IS_ERR(rt)) {
		printk(KERN_ERR "%s: ip_route_output_key failed for 0x%08X\n",
				__func__, dst_ip);
		return rc;
	}

	if (netif_is_bond_slave(netdev))
                                ^^^^^^

netdev is not set!
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw
Quoted 2 lines · Stephen Hemminger

This commit:
commit 2a4c97ead4b375a64063523210939b87ad225b85

Actually I think it was 1765a575334f ("net: make dev->master general") which went in through the net tree and which had:

- if (nesvnic->netdev->master)
+ if (netif_is_bond_slave(netdev))

presumably that should be netif_is_bond_slave(nesvnic->netdev).

I'll queue this up:

RDMA/nes: Fix test of uninitialized netdev

Commit 1765a575334f ("net: make dev->master general") introduced a test of an uninitialized netdev. Fix the code so the intended netdev is tested.

---
 drivers/infiniband/hw/nes/nes_cm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
(quoted diff) +0 -0

b/drivers/infiniband/hw/nes/nes_cm.c
index ef32915..cfa3a2b 100644

drivers/infiniband/hw/nes/nes_cm.c +0 -0
@@ -1116,7 +1116,7 @@ static int nes_addr_resolve_neigh(struct

nes_vnic *nesvnic, u32 dst_ip, int arpi

                return rc;
        }

- if (netif_is_bond_slave(netdev))
+ if (netif_is_bond_slave(nesvnic->netdev))

                netdev = nesvnic->netdev->master;
        else
                netdev = nesvnic->netdev;

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to a message not in the archive
Quoted 11 lines · Roland Dreier
Quoted 2 lines · Stephen Hemminger

This commit:
commit 2a4c97ead4b375a64063523210939b87ad225b85

Actually I think it was 1765a575334f ("net: make dev->master general") which went in through the net tree and which had:

(quoted diff) +1 -1
-       if (nesvnic->netdev->master)
+       if (netif_is_bond_slave(netdev))
Quoted 1 line

presumably that should be netif_is_bond_slave(nesvnic->netdev).

Yes. That is the point.

Quoted 24 lines

I'll queue this up:

RDMA/nes: Fix test of uninitialized netdev

Commit 1765a575334f ("net: make dev->master general") introduced a test of an uninitialized netdev. Fix the code so the intended
netdev
is tested.

---
 drivers/infiniband/hw/nes/nes_cm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/infiniband/hw/nes/nes_cm.c +0 -0
index ef32915..cfa3a2b 100644
@@ -1116,7 +1116,7 @@ static int nes_addr_resolve_neigh(struct

nes_vnic *nesvnic, u32 dst_ip, int arpi

                return rc;
        }

drivers/infiniband/hw/nes/nes_cm.c

Quoted 5 lines
drivers/infiniband/hw/nes/nes_cm.c +1 -1
-       if (netif_is_bond_slave(netdev))
+       if (netif_is_bond_slave(nesvnic->netdev))
                netdev = nesvnic->netdev->master;
        else
                netdev = nesvnic->netdev;

Thanks for tracking this down and fixing!

Maciej
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html