]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
net: tipc: avoid possible garbage value
authorSu Hui <suhui@nfschina.com>
Thu, 12 Sep 2024 11:01:20 +0000 (19:01 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 14 Sep 2024 03:03:43 +0000 (20:03 -0700)
Clang static checker (scan-build) warning:
net/tipc/bcast.c:305:4:
The expression is an uninitialized value. The computed value will also
be garbage [core.uninitialized.Assign]
  305 |                         (*cong_link_cnt)++;
      |                         ^~~~~~~~~~~~~~~~~~

tipc_rcast_xmit() will increase cong_link_cnt's value, but cong_link_cnt
is uninitialized. Although it won't really cause a problem, it's better
to fix it.

Fixes: dca4a17d24ee ("tipc: fix potential hanging after b/rcast changing")
Signed-off-by: Su Hui <suhui@nfschina.com>
Reviewed-by: Justin Stitt <justinstitt@google.com>
Link: https://patch.msgid.link/20240912110119.2025503-1-suhui@nfschina.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/tipc/bcast.c

index 593846d252143c09eccd05a5e1192f92ca9dd36a..114fef65f92eaba6476a33efd08442c2e5d3db38 100644 (file)
@@ -320,8 +320,8 @@ static int tipc_mcast_send_sync(struct net *net, struct sk_buff *skb,
 {
        struct tipc_msg *hdr, *_hdr;
        struct sk_buff_head tmpq;
+       u16 cong_link_cnt = 0;
        struct sk_buff *_skb;
-       u16 cong_link_cnt;
        int rc = 0;
 
        /* Is a cluster supporting with new capabilities ? */