]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
rocker: move dereference before free
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 28 Jun 2017 11:44:21 +0000 (14:44 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 29 Jun 2017 18:19:24 +0000 (14:19 -0400)
My static checker complains that ofdpa_neigh_del() can sometimes free
"found".   It just makes sense to use it first before deleting it.

Fixes: ecf244f753e0 ("rocker: fix maybe-uninitialized warning")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/rocker/rocker_ofdpa.c

index 2ae85245478087d2d640617bd79bfbfabd5f0763..a9ce82d3e9cf4b8875474cd62f02ccbfc322bc20 100644 (file)
@@ -1505,8 +1505,8 @@ static int ofdpa_port_ipv4_nh(struct ofdpa_port *ofdpa_port,
                *index = entry->index;
                resolved = false;
        } else if (removing) {
-               ofdpa_neigh_del(trans, found);
                *index = found->index;
+               ofdpa_neigh_del(trans, found);
        } else if (updating) {
                ofdpa_neigh_update(found, trans, NULL, false);
                resolved = !is_zero_ether_addr(found->eth_dst);