]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
rdma: stat: initialize ret in stat_qp_show_parse_cb()
authorAndrea Claudi <aclaudi@redhat.com>
Tue, 13 Apr 2021 22:50:57 +0000 (00:50 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 14 Apr 2021 02:16:55 +0000 (19:16 -0700)
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>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
rdma/stat.c

index 75d452885472b8f2118452e2dfa69abfae7d9ce2..3abedae74534d0dc4186ea974f842dd835481c6e 100644 (file)
@@ -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] ||