IB/usnic: Fix resource leak in error case
authorNelson Escobar <neescoba@cisco.com>
Wed, 9 Dec 2015 18:42:18 +0000 (10:42 -0800)
committerDoug Ledford <dledford@redhat.com>
Wed, 23 Dec 2015 15:50:58 +0000 (10:50 -0500)
Signed-off-by: Dave Goodell <dgoodell@cisco.com>
Reviewed-by: Reese Faucette <rfaucett@cisco.com>
Reviewed-by: Xuyang Wang <xuywang@cisco.com>
Signed-off-by: Nelson Escobar <neescoba@cisco.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c

index b3068704f0792cb0f53aacf77ea9e2b6ad30a223..5f44b66ccb86481774733960b3577e83fcdfabc0 100644 (file)
@@ -575,7 +575,7 @@ alloc_res_chunk_list(struct usnic_vnic *vnic,
        return res_chunk_list;
 
 out_free_res:
-       for (i--; i > 0; i--)
+       for (i--; i >= 0; i--)
                usnic_vnic_put_resources(res_chunk_list[i]);
        kfree(res_chunk_list);
        return ERR_PTR(err);