From patchwork Mon Jul 31 10:21:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 795684 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xLbMH5TPdz9s81 for ; Mon, 31 Jul 2017 20:30:51 +1000 (AEST) Received: from localhost ([::1]:58609 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dc7yL-0002Eo-KH for incoming@patchwork.ozlabs.org; Mon, 31 Jul 2017 06:30:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dc7ur-0007q5-2H for qemu-devel@nongnu.org; Mon, 31 Jul 2017 06:27:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dc7uo-0001zl-Gz for qemu-devel@nongnu.org; Mon, 31 Jul 2017 06:27:13 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:40697) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dc7uo-0001yo-8f; Mon, 31 Jul 2017 06:27:10 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 8A0C742ABE; Mon, 31 Jul 2017 13:27:09 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.corpit.ru (Postfix) with SMTP id B74CFB87; Mon, 31 Jul 2017 13:21:45 +0300 (MSK) Received: (nullmailer pid 5571 invoked by uid 1000); Mon, 31 Jul 2017 10:21:45 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Mon, 31 Jul 2017 13:21:35 +0300 Message-Id: <6860710cc3864382a898c847d722f950b5e01a6e.1501496349.git.mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 86.62.121.231 Subject: [Qemu-devel] [PULL 16/25] syscall: fix use of uninitialized values X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé 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)