Skip to content

Commit bfd2793

Browse files
Yann Droneauddavem330
authored andcommitted
RDMA/cxgb4: set error code on kmalloc() failure
If kmalloc() fails in c4iw_alloc_ucontext(), the function leaves but does not set an error code in ret variable: it will return 0 to the caller. This patch set ret to -ENOMEM in such case. Cc: Steve Wise <[email protected]> Cc: Steve Wise <[email protected]> Signed-off-by: Yann Droneaud <[email protected]> Acked-by: Steve Wise <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f3c9ec0 commit bfd2793

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/infiniband/hw/cxgb4/provider.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,10 @@ static struct ib_ucontext *c4iw_alloc_ucontext(struct ib_device *ibdev,
128128
rhp->rdev.flags |= T4_STATUS_PAGE_DISABLED;
129129
} else {
130130
mm = kmalloc(sizeof(*mm), GFP_KERNEL);
131-
if (!mm)
131+
if (!mm) {
132+
ret = -ENOMEM;
132133
goto err_free;
134+
}
133135

134136
uresp.status_page_size = PAGE_SIZE;
135137

0 commit comments

Comments
 (0)