Skip to content

Commit

Permalink
IB: cxgb3: delay freeing mem untill entirely done with it
Browse files Browse the repository at this point in the history
Sure, it's just the pointer value we use, but the coverity checker
complains about a use-after-free bug and it really does seem cleaner
to delay freeing until we are entirely done with the memory. So,
rearrange the code to move the kfree() later untill we are completely
done.
Trivial and harmless, but nice IMHO.

Signed-off-by: Jesper Juhl <[email protected]>
Reviewed-by: Steve Wise <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
  • Loading branch information
jjuhl authored and Jiri Kosina committed Jan 29, 2013
1 parent c353516 commit fe194f1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/cxgb3/iwch_provider.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,8 +783,8 @@ static int iwch_dealloc_mw(struct ib_mw *mw)
mmid = (mw->rkey) >> 8;
cxio_deallocate_window(&rhp->rdev, mhp->attr.stag);
remove_handle(rhp, &rhp->mmidr, mmid);
kfree(mhp);
PDBG("%s ib_mw %p mmid 0x%x ptr %p\n", __func__, mw, mmid, mhp);
kfree(mhp);
return 0;
}

Expand Down

0 comments on commit fe194f1

Please sign in to comment.