netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2] net: tipc: avoid possible garbage value
@ 2024-09-14 10:26 Su Hui
  2024-09-14 14:12 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Su Hui @ 2024-09-14 10:26 UTC (permalink / raw)
  To: jmaloy, ying.xue, davem, edumazet, kuba, pabeni, nathan,
	ndesaulniers, morbo, justinstitt
  Cc: Su Hui, horms, dan.carpenter, tuong.t.lien, netdev,
	tipc-discussion, linux-kernel, llvm, kernel-janitors

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>
---
v2:
- sending to net rather than net-next
- keeping xmas tree order

 net/tipc/bcast.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index 593846d25214..114fef65f92e 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -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 ? */
-- 
2.30.2


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

* Re: [PATCH net v2] net: tipc: avoid possible garbage value
  2024-09-14 10:26 [PATCH net v2] net: tipc: avoid possible garbage value Su Hui
@ 2024-09-14 14:12 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2024-09-14 14:12 UTC (permalink / raw)
  To: Su Hui
  Cc: jmaloy, ying.xue, davem, edumazet, pabeni, nathan, ndesaulniers,
	morbo, justinstitt, horms, dan.carpenter, tuong.t.lien, netdev,
	tipc-discussion, linux-kernel, llvm, kernel-janitors

On Sat, 14 Sep 2024 18:26:21 +0800 Su Hui wrote:
> 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>

Applied, thanks:

https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=99655a304e450baaae6b396cb942b9e47659d644
-- 
pw-bot: accept

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

end of thread, other threads:[~2024-09-14 14:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-14 10:26 [PATCH net v2] net: tipc: avoid possible garbage value Su Hui
2024-09-14 14:12 ` Jakub Kicinski

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