Skip to contentSkip to conversation

RDMA/core: Fix error code in stat_get_doit_qp()

PATCH Applied Dan Carpenter 3 participants 3 messages Aug 9, 2019 – Aug 12, 2019

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

PATCH 1/1 RDMA/core: Fix error code in stat_get_doit_qp()

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")
---
 drivers/infiniband/core/nldev.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/infiniband/core/nldev.c +6 -2
index e287b71a1cfd..cc08218f1ef7 100644
@@ -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);
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Dan Carpenter

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")
---
 drivers/infiniband/core/nldev.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Thanks,

Applied
#2 lore raw
Quoted 12 lines · Leon Romanovsky
Quoted 10 lines · Dan Carpenter

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

---
 drivers/infiniband/core/nldev.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Quoted 2 lines

Thanks,

Thanks, applied to for-rc.

Signature · 3 lines
Doug Ledford <[email protected]>
    GPG KeyID: B826A3330E572FDD
    Fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD