netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] rdma: stat: initialize ret in stat_qp_show_parse_cb()
@ 2021-04-13 22:50 Andrea Claudi
  2021-04-18 11:07 ` Leon Romanovsky
  0 siblings, 1 reply; 4+ messages in thread
From: Andrea Claudi @ 2021-04-13 22:50 UTC (permalink / raw)
  To: netdev; +Cc: stephen, dsahern

In the unlikely case in which the mnl_attr_for_each_nested() cycle is
not executed, this function return an uninitialized value.

Fix this initializing ret to 0.

Fixes: 5937552b42e4 ("rdma: Add "stat qp show" support")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
---
 rdma/stat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rdma/stat.c b/rdma/stat.c
index 75d45288..3abedae7 100644
--- a/rdma/stat.c
+++ b/rdma/stat.c
@@ -307,7 +307,7 @@ static int stat_qp_show_parse_cb(const struct nlmsghdr *nlh, void *data)
 	struct rd *rd = data;
 	const char *name;
 	uint32_t idx;
-	int ret;
+	int ret = 0;
 
 	mnl_attr_parse(nlh, 0, rd_attr_cb, tb);
 	if (!tb[RDMA_NLDEV_ATTR_DEV_INDEX] || !tb[RDMA_NLDEV_ATTR_DEV_NAME] ||
-- 
2.30.2


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

end of thread, other threads:[~2021-04-18 12:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-13 22:50 [PATCH iproute2] rdma: stat: initialize ret in stat_qp_show_parse_cb() Andrea Claudi
2021-04-18 11:07 ` Leon Romanovsky
2021-04-18 12:00   ` Andrea Claudi
2021-04-18 12:06     ` Leon Romanovsky

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