linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RDMA/core: Fix error code in stat_get_doit_qp()
@ 2019-08-09 10:13 Dan Carpenter
  2019-08-11  9:56 ` Leon Romanovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2019-08-09 10:13 UTC (permalink / raw)
  To: Doug Ledford, Mark Zhang
  Cc: Jason Gunthorpe, Leon Romanovsky, Parav Pandit, Majd Dibbiny,
	Steve Wise, linux-rdma, kernel-janitors

We need to set the error codes on these paths.  Currently the only
possible error code is -EMSGSIZE so that's what the patch uses.

Fixes: 83c2c1fcbd08 ("RDMA/nldev: Allow get counter mode through RDMA netlink")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/infiniband/core/nldev.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index e287b71a1cfd..cc08218f1ef7 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -1952,12 +1952,16 @@ static int stat_get_doit_qp(struct sk_buff *skb, struct nlmsghdr *nlh,
 
 	if (fill_nldev_handle(msg, device) ||
 	    nla_put_u32(msg, RDMA_NLDEV_ATTR_PORT_INDEX, port) ||
-	    nla_put_u32(msg, RDMA_NLDEV_ATTR_STAT_MODE, mode))
+	    nla_put_u32(msg, RDMA_NLDEV_ATTR_STAT_MODE, mode)) {
+		ret = -EMSGSIZE;
 		goto err_msg;
+	}
 
 	if ((mode == RDMA_COUNTER_MODE_AUTO) &&
-	    nla_put_u32(msg, RDMA_NLDEV_ATTR_STAT_AUTO_MODE_MASK, mask))
+	    nla_put_u32(msg, RDMA_NLDEV_ATTR_STAT_AUTO_MODE_MASK, mask)) {
+		ret = -EMSGSIZE;
 		goto err_msg;
+	}
 
 	nlmsg_end(msg, nlh);
 	ib_device_put(device);
-- 
2.20.1


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

* Re: [PATCH] RDMA/core: Fix error code in stat_get_doit_qp()
  2019-08-09 10:13 [PATCH] RDMA/core: Fix error code in stat_get_doit_qp() Dan Carpenter
@ 2019-08-11  9:56 ` Leon Romanovsky
  2019-08-12 15:10   ` Doug Ledford
  0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2019-08-11  9:56 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Doug Ledford, Mark Zhang, Jason Gunthorpe, Parav Pandit,
	Majd Dibbiny, Steve Wise, linux-rdma, kernel-janitors

On Fri, Aug 09, 2019 at 01:13:19PM +0300, Dan Carpenter wrote:
> We need to set the error codes on these paths.  Currently the only
> possible error code is -EMSGSIZE so that's what the patch uses.
>
> Fixes: 83c2c1fcbd08 ("RDMA/nldev: Allow get counter mode through RDMA netlink")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/infiniband/core/nldev.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>

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

* Re: [PATCH] RDMA/core: Fix error code in stat_get_doit_qp()
  2019-08-11  9:56 ` Leon Romanovsky
@ 2019-08-12 15:10   ` Doug Ledford
  0 siblings, 0 replies; 3+ messages in thread
From: Doug Ledford @ 2019-08-12 15:10 UTC (permalink / raw)
  To: Leon Romanovsky, Dan Carpenter
  Cc: Mark Zhang, Jason Gunthorpe, Parav Pandit, Majd Dibbiny,
	Steve Wise, linux-rdma, kernel-janitors

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

On Sun, 2019-08-11 at 12:56 +0300, Leon Romanovsky wrote:
> On Fri, Aug 09, 2019 at 01:13:19PM +0300, Dan Carpenter wrote:
> > We need to set the error codes on these paths.  Currently the only
> > possible error code is -EMSGSIZE so that's what the patch uses.
> > 
> > Fixes: 83c2c1fcbd08 ("RDMA/nldev: Allow get counter mode through
> > RDMA netlink")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> >  drivers/infiniband/core/nldev.c | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> 
> Thanks,
> Reviewed-by: Leon Romanovsky <leonro@mellanox.com>

Thanks, applied to for-rc.

-- 
Doug Ledford <dledford@redhat.com>
    GPG KeyID: B826A3330E572FDD
    Fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2019-08-12 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-09 10:13 [PATCH] RDMA/core: Fix error code in stat_get_doit_qp() Dan Carpenter
2019-08-11  9:56 ` Leon Romanovsky
2019-08-12 15:10   ` Doug Ledford

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).