From nobody Fri Sep 20 23:04:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1604560209; cv=none; d=zohomail.com; s=zohoarc; b=BmRvz7sXgPp19ApxfN1y+kpmo4BoJLScUEJjJzT1VLjFOhmao3W33QywvO6E1RPw5qbfa74mLIRA3XSOWQkupme8KzYeKjqL4UbenKRUHWLwGtn190BCGxAJAClvzhok5NizyCB1aPmt29IC0jRshOmcnX70H9K3pTvYdtjYI8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604560209; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZoT1esqwDZDwXLr3IMkdjjzDbVYKS9ZE95cF2iQOEIY=; b=l8GsPr83KE8n6cvkLj4QsmYNYg2gHd2v/CS2FZHQKDngWoIN99zTw0oxWgXAodbJocN1hwOA2lL70M2v3kHIdql9P9jAi9uzjHxvjwJ8sdDahSXeihRk8W/dIZd0bCegvQY8u90LC6OdrIcP72ieHisPBTJafK+a+sWbO47WOEY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604560209881814.0525117554726; Wed, 4 Nov 2020 23:10:09 -0800 (PST) Received: from localhost ([::1]:35876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kaZPM-000204-Qc for importer@patchew.org; Thu, 05 Nov 2020 02:10:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kaZO9-0000IZ-TK for qemu-devel@nongnu.org; Thu, 05 Nov 2020 02:08:53 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:33015) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kaZO2-0007Xg-8j for qemu-devel@nongnu.org; Thu, 05 Nov 2020 02:08:53 -0500 Received: from localhost.localdomain ([82.252.154.198]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MmDVA-1jsOrb0f8C-00iFFw; Thu, 05 Nov 2020 08:08:43 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 2/4] linux-user: Use "!= 0" when checking if MAP_FIXED_NOREPLACE is non-zero Date: Thu, 5 Nov 2020 08:08:35 +0100 Message-Id: <20201105070837.558332-3-laurent@vivier.eu> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201105070837.558332-1-laurent@vivier.eu> References: <20201105070837.558332-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:xp3EU+evYL7WeGagg5hHecSr5tQF2Vv/mnqq4smCZOuZhmFJ3Ct oiR3KDfFZFNukgEwTaUNXooykdLU7bWSs3PXotrpvWWSew7/d1Jktn0sQZRARv5i/6Pe5tU RSAKHN/KqfbAFsUoxJ5/KzZYA9KOC3pMb85DyJVPZGp/aaKm/iMItdwDC2UM44Nb3NiSw3G JEQYLrcupIYqiqSxSRogA== X-UI-Out-Filterresults: notjunk:1;V03:K0:AS40tPH6BGM=:0gePM1PvTBvvlM293FzAoJ kEg86ofm0zyF1rZIlUYNBsGbM3XqLSf0LceOYHbddvR7K+qK63ZFVGJ9BNAjkvkYwzC4xYcgL EOoewIo7hQ/BeDbDlqFI1mShiXXA4h6tc4HQm8pKzIELMYYw/hT2IAkE3Vb2VR4RbLa3wT1aC J9Gz5ApidMbHqdnFgoNCpmysjB5+sVFkX/c5qhQ9VSkyFQ9B3T8lQ/XQvbT2ewR8Vue8SXIwi F4xWaj8JWp44xjuF1GwrWHY5D8rBAuMgnl1YWjhOWsF9vfGKLsKEGd5hhX6PbIMuPsD0fjSi3 YmhMo06ayTyQxFfvagnghRNDyajbYqNi8uBl6M3YeZRS4poP8ESkD3xrcqSOtKkxmWHc+rlfl qrjxzDSq/8Oyme4CpNiShvZnTzYrh0zCvc8R5HrL2rdNcTEyl30a/RO/ezl4u Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=212.227.126.133; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/05 02:08:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell In pgd_find_hole_fallback(), Coverity doesn't like the use of "if (MAP_FIXED_NOREPLACE || ...)" because it's using a logical operator on a constant other than 0 or 1 and its heuristic thinks we might have intended a bitwise operator instead. The logic is correct (we are checking whether the host really has a MAP_FIXED_NOREPLACE or whether we fell back to the "#define as 0 to ignore" from osdep.h); make Coverity happier by explicitly writing out the comparison with zero. Fixes: Coverity CID 1431059 Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20201103142636.21125-1-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/elfload.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index bf8c1bd25330..cae41d504d36 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2188,7 +2188,8 @@ static uintptr_t pgd_find_hole_fallback(uintptr_t gue= st_size, uintptr_t brk, PROT_NONE, flags, -1, 0); if (mmap_start !=3D MAP_FAILED) { munmap((void *) align_start, guest_size); - if (MAP_FIXED_NOREPLACE || mmap_start =3D=3D (void *) alig= n_start) { + if (MAP_FIXED_NOREPLACE !=3D 0 || + mmap_start =3D=3D (void *) align_start) { return (uintptr_t) mmap_start + offset; } } --=20 2.28.0