diff options
author | Kyeongdon Kim <kyeongdon.kim@lge.com> | 2018-10-16 08:57:26 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-12-01 11:16:33 +0300 |
commit | 7ac437558e4a68f0127cba24bad6f98cff5c736f (patch) | |
tree | 1f75e9381d2eda38d852f32ec74be607d8cacabf /net/unix | |
parent | 5e110ec2d924171458f4099c53b04b7e30ffa929 (diff) | |
download | linux-7ac437558e4a68f0127cba24bad6f98cff5c736f.tar.xz |
net: fix warning in af_unix
[ Upstream commit 33c4368ee2589c165aebd8d388cbd91e9adb9688 ]
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/unix')
-rw-r--r-- | net/unix/af_unix.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 231b6c032d2c..d2d6ff0c6265 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -225,6 +225,8 @@ static inline void unix_release_addr(struct unix_address *addr) static int unix_mkname(struct sockaddr_un *sunaddr, int len, unsigned int *hashp) { + *hashp = 0; + if (len <= sizeof(short) || len > sizeof(*sunaddr)) return -EINVAL; if (!sunaddr || sunaddr->sun_family != AF_UNIX) |