linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RDMA/nldev: missing error code in nldev_res_get_doit()
@ 2018-02-01 10:01 Dan Carpenter
  2018-02-01 10:34 ` Leon Romanovsky
  2018-02-01 22:50 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2018-02-01 10:01 UTC (permalink / raw)
  To: Doug Ledford, Leon Romanovsky
  Cc: Jason Gunthorpe, Steve Wise, Mark Bloch, linux-rdma, kernel-janitors

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

Fixes: bf3c5a93c523 ("RDMA/nldev: Provide global resource utilization")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index fa8655e3b3ed..5326a684555f 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -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),

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/nldev: missing error code in nldev_res_get_doit()
  2018-02-01 10:01 [PATCH] RDMA/nldev: missing error code in nldev_res_get_doit() Dan Carpenter
@ 2018-02-01 10:34 ` Leon Romanovsky
  2018-02-01 22:50 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2018-02-01 10:34 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Doug Ledford, Jason Gunthorpe, Steve Wise, Mark Bloch,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 421 bytes --]

On Thu, Feb 01, 2018 at 01:01:48PM +0300, Dan Carpenter wrote:
> We should return -ENOMEM if the allocation fails.  The current code
> accidentally returns success.
>
> Fixes: bf3c5a93c523 ("RDMA/nldev: Provide global resource utilization")
> Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
>

Thanks Dan,
Reviewed-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/nldev: missing error code in nldev_res_get_doit()
  2018-02-01 10:01 [PATCH] RDMA/nldev: missing error code in nldev_res_get_doit() Dan Carpenter
  2018-02-01 10:34 ` Leon Romanovsky
@ 2018-02-01 22:50 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2018-02-01 22:50 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Doug Ledford, Leon Romanovsky, Steve Wise, Mark Bloch,
	linux-rdma, kernel-janitors

On Thu, Feb 01, 2018 at 01:01:48PM +0300, Dan Carpenter wrote:
> We should return -ENOMEM if the allocation fails.  The current code
> accidentally returns success.
> 
> Fixes: bf3c5a93c523 ("RDMA/nldev: Provide global resource utilization")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reviewed-by: Leon Romanovsky <leonro@mellanox.com>

Applied to for-next, thanks

Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-01 22:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-01 10:01 [PATCH] RDMA/nldev: missing error code in nldev_res_get_doit() Dan Carpenter
2018-02-01 10:34 ` Leon Romanovsky
2018-02-01 22:50 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).