From 6860710cc3864382a898c847d722f950b5e01a6e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 26 Jul 2017 23:42:18 -0300 Subject: [PATCH] syscall: fix use of uninitialized values MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit linux-user/syscall.c:1627:35: warning: 1st function call argument is an uninitialized value target_saddr->sa_family = tswap16(addr->sa_family); ^~~~~~~~~~~~~~~~~~~~~~~~ linux-user/syscall.c:1629:25: warning: The left operand of '==' is a garbage value if (addr->sa_family == AF_NETLINK && len >= sizeof(struct sockaddr_nl)) { ~~~~~~~~~~~~~~~ ^ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Signed-off-by: Michael Tokarev --- linux-user/syscall.c | 1 + 1 file changed, 1 insertion(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 71d45a9963..81f52f7483 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1622,6 +1622,7 @@ static inline abi_long host_to_target_sockaddr(abi_ulong target_addr, if (len == 0) { return 0; } + assert(addr); target_saddr = lock_user(VERIFY_WRITE, target_addr, len, 0); if (!target_saddr) -- 2.30.2