mlx4: fix kfree on error path in new_steering_entry()
authorMariusz Kozlowski <mk@lab.zgora.pl>
Mon, 4 Apr 2011 05:04:01 +0000 (22:04 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 Apr 2011 05:04:01 +0000 (22:04 -0700)
On error path kfree() should get pointer to memory allocated by
kmalloc() not the address of variable holding it (which is on stack).

Signed-off-by: Mariusz Kozlowski <mk@lab.zgora.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/mlx4/mcg.c

index 37150b2f6425566b015d4dfd6d38ee207b14e232..c6d336aed2d92be39ccb4f3ee8e743ed764994c9 100644 (file)
@@ -111,7 +111,7 @@ static int new_steering_entry(struct mlx4_dev *dev, u8 vep_num, u8 port,
        u32 members_count;
        struct mlx4_steer_index *new_entry;
        struct mlx4_promisc_qp *pqp;
-       struct mlx4_promisc_qp *dqp;
+       struct mlx4_promisc_qp *dqp = NULL;
        u32 prot;
        int err;
        u8 pf_num;
@@ -184,7 +184,7 @@ out_mailbox:
 out_alloc:
        if (dqp) {
                list_del(&dqp->list);
-               kfree(&dqp);
+               kfree(dqp);
        }
        list_del(&new_entry->list);
        kfree(new_entry);