Linux-RDMA Archive on lore.kernel.org
 help / color / 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	[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, back to index

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

Linux-RDMA Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rdma/0 linux-rdma/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rdma linux-rdma/ https://lore.kernel.org/linux-rdma \
		linux-rdma@vger.kernel.org linux-rdma@archiver.kernel.org
	public-inbox-index linux-rdma


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rdma


AGPL code for this site: git clone https://public-inbox.org/ public-inbox