linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: fix waring in af_unix
@ 2018-10-12 10:34 Kyeongdon Kim
  2018-10-16  5:16 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Kyeongdon Kim @ 2018-10-12 10:34 UTC (permalink / raw)
  To: davem, ktkhai, viro, garsilva, jbaron, dvlasenk, xiyou.wangcong
  Cc: netdev, linux-kernel, kyeongdon.kim

This fixes the "'hash' may be used uninitialized in this function"

net/unix/af_unix.c:1041:20: warning: 'hash' may be used uninitialized in this function [-Wmaybe-uninitialized]
  addr->hash = hash ^ sk->sk_type;
                      ^

Signed-off-by: Kyeongdon Kim <kyeongdon.kim@lge.com>
---
 net/unix/af_unix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index d1edfa3..e6cecc8 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -989,7 +989,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 	struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr;
 	char *sun_path = sunaddr->sun_path;
 	int err;
-	unsigned int hash;
+	unsigned int hash = 0;
 	struct unix_address *addr;
 	struct hlist_head *list;
 	struct path path = { };
-- 
2.6.2


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

* Re: [PATCH] net: fix waring in af_unix
  2018-10-12 10:34 [PATCH] net: fix waring in af_unix Kyeongdon Kim
@ 2018-10-16  5:16 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-10-16  5:16 UTC (permalink / raw)
  To: kyeongdon.kim
  Cc: ktkhai, viro, garsilva, jbaron, dvlasenk, xiyou.wangcong, netdev,
	linux-kernel

From: Kyeongdon Kim <kyeongdon.kim@lge.com>
Date: Fri, 12 Oct 2018 19:34:14 +0900

> This fixes the "'hash' may be used uninitialized in this function"
> 
> net/unix/af_unix.c:1041:20: warning: 'hash' may be used uninitialized in this function [-Wmaybe-uninitialized]
>   addr->hash = hash ^ sk->sk_type;
>                       ^
> 
> Signed-off-by: Kyeongdon Kim <kyeongdon.kim@lge.com>

Please put the initialization at the start of unix_mkname() as a similar
situation exists elsewhere in this file, and the compiler will eventually
warn there too.

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

end of thread, other threads:[~2018-10-16  5:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-12 10:34 [PATCH] net: fix waring in af_unix Kyeongdon Kim
2018-10-16  5:16 ` David Miller

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