Skip to contentSkip to conversation

RDMA/cxgb4: set error code on kmalloc() failure

PATCH New Yann Droneaud 3 participants 3 messages Mar 26, 2014 – Mar 28, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/infiniband/hw/cxgb4/provider.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/cxgb4/provider.c +3 -1
index e36d2a27c431..79429256023a 100644
@@ -128,8 +128,10 @@ static struct ib_ucontext *c4iw_alloc_ucontext(struct ib_device *ibdev,
 		rhp->rdev.flags |= T4_STATUS_PAGE_DISABLED;
 	} else {
 		mm = kmalloc(sizeof(*mm), GFP_KERNEL);
-		if (!mm)
+		if (!mm) {
+			ret = -ENOMEM;
 			goto err_free;
+		}
 
 		uresp.status_page_size = PAGE_SIZE;
 
Signature · 6 lines
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1395846311-29288-1-git-send-email-ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org

#2 lore raw

PATCH 1/1 RDMA/cxgb4: set error code on kmalloc() failure

Note: This fix applies only to net-next because the commit that introduced this is still pending in net-next:

commit 05eb23893c2cf9502a9cec0c32e7f1d1ed2895c8

Author: Steve Wise <[email protected]>
Date:   Fri Mar 14 21:52:08 2014 +0530

cxgb4/iw_cxgb4: Doorbell Drop Avoidance Bug Fixes

Dave, can you please merge this?

Thanks,

Steve.

-----Original Message-----
From: Yann Droneaud [mailto:[email protected]]
Sent: Wednesday, March 26, 2014 10:05 AM
To: Roland Dreier; Roland Dreier
Cc: Yann Droneaud; [email protected]; Steve Wise; Steve Wise
Subject: [PATCH] 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.

---
 drivers/infiniband/hw/cxgb4/provider.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/infiniband/hw/cxgb4/provider.c
index e36d2a27c431..79429256023a 100644

drivers/infiniband/hw/cxgb4/provider.c +0 -0
@@ -128,8 +128,10 @@ static struct ib_ucontext *c4iw_alloc_ucontext(struct ib_device

*ibdev,
rhp->rdev.flags |= T4_STATUS_PAGE_DISABLED;
} else {
mm = kmalloc(sizeof(*mm), GFP_KERNEL);
- if (!mm)
+ if (!mm) {
+ ret = -ENOMEM;
goto err_free;
+ }

uresp.status_page_size = PAGE_SIZE;

Signature · 6 lines
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

From: "Steve Wise" <[email protected]>
Date: Wed, 26 Mar 2014 10:25:22 -0500

Quoted 5 lines

Note: This fix applies only to net-next because the commit that introduced this is still pending in net-next:

Quoted 8 lines

commit 05eb23893c2cf9502a9cec0c32e7f1d1ed2895c8

Author: Steve Wise <[email protected]>
Date:   Fri Mar 14 21:52:08 2014 +0530

cxgb4/iw_cxgb4: Doorbell Drop Avoidance Bug Fixes

Dave, can you please merge this?

Done, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html