From patchwork Thu Jul 27 02:42:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 794183 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=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ZSgW2A9+"; dkim-atps=neutral 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 3xHxMP3gDVz9s72 for ; Thu, 27 Jul 2017 12:51:45 +1000 (AEST) Received: from localhost ([::1]:40899 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daYtr-0005PI-Dr for incoming@patchwork.ozlabs.org; Wed, 26 Jul 2017 22:51:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daYlO-0005Sr-QY for qemu-devel@nongnu.org; Wed, 26 Jul 2017 22:42:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1daYlL-0007sp-Kj for qemu-devel@nongnu.org; Wed, 26 Jul 2017 22:42:58 -0400 Received: from mail-qt0-x241.google.com ([2607:f8b0:400d:c0d::241]:37538) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1daYlL-0007sO-HD; Wed, 26 Jul 2017 22:42:55 -0400 Received: by mail-qt0-x241.google.com with SMTP id d10so7551490qtb.4; Wed, 26 Jul 2017 19:42:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LFnsM+SIPFmAiVmewUpc9Vn/ZkRY06Gh2wlts65N5d0=; b=ZSgW2A9+3y1VA8IiRn81CJPEnw7GtGgi6242ZIr+jwYCPwCz+StCvmeuvsBT7Yc6C0 FlnFb5eSv9lRd6hHnW9IJFctV70BjkVEXqVZrBi5EwooE+p76O+KVLKcgD5bXZdPxiJu tLEDfsy8Z+ximgvD3ucFI+g8/G5/F+ZgGBJ1ORHCZWkePa2Npik2YUtdZ5RZE5myirIy UGhxA2ZA6cfCJBmY+ccv1BqEIIRM+5xixKl6iGJfSq5hUL45k8RWm+VwByWKnAzV0sFN NYc517E3sIB4Iia6IMDXY2JIc1ctI9ZGJN8lK/hXHnGQv2GLIaY+NgjDAJRUf5znDuXm ZmGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=LFnsM+SIPFmAiVmewUpc9Vn/ZkRY06Gh2wlts65N5d0=; b=L4nOaPDVf9c2yGMx0ijofc40hbA04Po+bc8kbZNu+gDKsFYRA0hgp9b5WsEw9Wbka+ tTV5ENmCswJvhF+HOSVKLIA3MgtRj7BItdBtyLMmqi+L+6KuLRD2GZ2DAeqAbtwTcuj4 2dgkVhXalLVdJwy7AK2w+sCtC6xD4anWrUjVgW4vgxKNss2ABBXVOQBK0CPrG/NtKDaB WyHmIQBKgG0fHF3diIMeXDG3JQ/bnRc9B+r2ckK1d+bpbPHF6tfXyY1Tt4aHXj50EnPw G0iy8L2C7jM8UAG38PRkfe9ehBWafe1U6lEvkOrkOXUCeZ9idYqha3UG84j0A02NXCDU 2dhA== X-Gm-Message-State: AIVw111IQnw8/x+e0pSGB9KPANqOzNYF6upGsZPhThS1RHk270Dz/MrD 0Sn+9jskXV/eIw== X-Received: by 10.237.63.67 with SMTP id q3mr4347854qtf.280.1501123374947; Wed, 26 Jul 2017 19:42:54 -0700 (PDT) Received: from yoga.offpageads.com ([138.117.48.223]) by smtp.gmail.com with ESMTPSA id g27sm13221147qtg.84.2017.07.26.19.42.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jul 2017 19:42:54 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Peter Maydell , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Eric Blake , Dmitry Fleytman , Jason Wang Date: Wed, 26 Jul 2017 23:42:12 -0300 Message-Id: <20170727024224.22900-8-f4bug@amsat.org> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170727024224.22900-1-f4bug@amsat.org> References: <20170727024224.22900-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::241 Subject: [Qemu-devel] [PATCH for 2.10 v2 07/20] net/eth: fix incorrect check of iov_to_buf() return value 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, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" So we have sizeof(struct in6_address) != sizeof(uintptr_t) and Clang > Coverity on this, see 4555ca6816c :) net/eth.c:426:30: warning: The code calls sizeof() on a pointer type. This can produce an unexpected result return bytes_read == sizeof(dst_addr); ^ ~~~~~~~~~~ net/eth.c:475:34: warning: The code calls sizeof() on a pointer type. This can produce an unexpected result return bytes_read == sizeof(src_addr); ^ ~~~~~~~~~~ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Dmitry Fleytman --- net/eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/eth.c b/net/eth.c index 5b9ba26a56..ae5d881aae 100644 --- a/net/eth.c +++ b/net/eth.c @@ -423,7 +423,7 @@ _eth_get_rss_ex_dst_addr(const struct iovec *pkt, int pkt_frags, rthdr_offset + sizeof(*ext_hdr), dst_addr, sizeof(*dst_addr)); - return bytes_read == sizeof(dst_addr); + return bytes_read == sizeof(*dst_addr); } return false; @@ -472,7 +472,7 @@ _eth_get_rss_ex_src_addr(const struct iovec *pkt, int pkt_frags, opt_offset + sizeof(opthdr), src_addr, sizeof(*src_addr)); - return bytes_read == sizeof(src_addr); + return bytes_read == sizeof(*src_addr); } opt_offset += optlen;