Skip to contentSkip to conversation

RDMA/nldev: missing error code in nldev_res_get_doit()

PATCH Applied Dan Carpenter 3 participants 3 messages Feb 1, 2018

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

PATCH 1/1 RDMA/nldev: missing error code in nldev_res_get_doit()

We should return -ENOMEM if the allocation fails. The current code accidentally returns success.

Fixes bf3c5a93c523 ("RDMA/nldev: Provide global resource utilization")
drivers/infiniband/core/nldev.c +3 -1
index fa8655e3b3ed..5326a684555f 100644
@@ -499,8 +499,10 @@ static int nldev_res_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
 		return -EINVAL;
 
 	msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
-	if (!msg)
+	if (!msg) {
+		ret = -ENOMEM;
 		goto err;
+	}
 
 	nlh = nlmsg_put(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq,
 			RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_RES_GET),