diff mbox series

RDMA/core: Fix error code in stat_get_doit_qp()

Message ID 20190809101311.GA17867@mwanda (mailing list archive)
State Mainlined
Commit 932727c55653c1d7838d0ecd0cdce4393be156e0
Headers show
Series RDMA/core: Fix error code in stat_get_doit_qp() | expand

Commit Message

Dan Carpenter Aug. 9, 2019, 10:13 a.m. UTC
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(-)

Comments

Leon Romanovsky Aug. 11, 2019, 9:56 a.m. UTC | #1
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>
Doug Ledford Aug. 12, 2019, 3:10 p.m. UTC | #2
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.
diff mbox series

Patch

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