From: Andrea Claudi Date: Tue, 13 Apr 2021 22:50:57 +0000 (+0200) Subject: rdma: stat: initialize ret in stat_qp_show_parse_cb() X-Git-Tag: v5.12.0~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16ce4d23661aee6cecfea0a8ded0ce11ef3a3ecd;p=thirdparty%2Fiproute2.git rdma: stat: initialize ret in stat_qp_show_parse_cb() 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 Signed-off-by: Stephen Hemminger --- diff --git a/rdma/stat.c b/rdma/stat.c index 75d452885..3abedae74 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] ||