From patchwork Fri Jun 23 14:44:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 695284 Delivered-To: patch@linaro.org Received: by 2002:adf:e885:0:0:0:0:0 with SMTP id d5csp1990250wrm; Fri, 23 Jun 2023 07:45:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4/J7EvWx7WzYHcZxPHkE0QvX/pnCbXsVQd29J54HWmvod9FXziRQabyLUaR5Cv8K6CEk3j X-Received: by 2002:a05:622a:15c5:b0:3f9:a59f:f200 with SMTP id d5-20020a05622a15c500b003f9a59ff200mr28669061qty.2.1687531545743; Fri, 23 Jun 2023 07:45:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687531545; cv=none; d=google.com; s=arc-20160816; b=rRNR5zjpRVfbcTxamNrw8BacCOcJFM2EfuJ7YlsXZLq2AKgmF4gbWRT6bmNHn3o938 3anPfbG0IbYmHmef0Kdy3/mWtwuFJyd3uVC/eZDwSQHFuQYbLCOUWltVrcsQ7BSz3YQF RHL33Kgd+ByvGlEwLBVmrT5LE6gIuWW6wPKTO+lvyQY9lI/m6mjdbGkB7GF5yNRyz1R0 BQbMa+Dwyzbh8su5JdhTWrfqBXkW7CdKKpKxBxFEv/9Q9S6hbR0WiIgDQZg1XXlNIjy4 toaIhDYXW1WOw5fKd/tGJE0VUmAf2kXRLQzFsyS/WIVVsZ1wskuwG4geTlr5lJSL/tkd 5ldA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=vEoZ1jB1oL976vNVyEoQyhbzqpIzJpu70/dSSiTM/2s=; b=IlpHDyeUQEYYM4htrtBb7LAvx48fWt8Qizb2OX9Njux3kqUWfXSxJyYqliYYH62hS2 iOWrXD3zioKNoWotLLlcMzi3NSMZdRHCIqIQbj1KJmqCnZecLqDgP+ExZh0D0XEm7QBv 2r3iNKKuVZIswjzj3br9zFF+4zYqQqQHom1q8ALJvItmUnqGkTp8q0fZm58O+BwwwHr9 bJ3/khT8+/0LQ0F+XHUBvoJsGDNt9xtmKpLIHmbnd8qd5MHNJO7cmTuRdovd6N2VqlaF VQVOXSHwl6L/ODIiUJG91AA41eY6p+hnX4au7EBG8pUBa3UL1SZyQx3jONYPaws9bbI6 clEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nOyuHlK4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o21-20020a05622a009500b0040082ed2df0si1009985qtw.558.2023.06.23.07.45.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 23 Jun 2023 07:45:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nOyuHlK4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCi1s-0000Db-DO; Fri, 23 Jun 2023 10:44:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qCi1b-0000Ak-Uu for qemu-devel@nongnu.org; Fri, 23 Jun 2023 10:44:36 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qCi1M-00049O-Cp for qemu-devel@nongnu.org; Fri, 23 Jun 2023 10:44:35 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3113dabc549so977786f8f.1 for ; Fri, 23 Jun 2023 07:44:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687531452; x=1690123452; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vEoZ1jB1oL976vNVyEoQyhbzqpIzJpu70/dSSiTM/2s=; b=nOyuHlK4A1QuWiv+3u12xPWRpsX97F/A3bTLIQncvYIyf5U4oD60dN9cGNiF/x/pHl m9QwCtkVFvOXmgNfTRXGxhIG+lWeiah/0D1XduReV8yg4IIIpeR6jyVua+/XysBDA/kR AIlOU2PzdohboNpIfnmZOFCaZjs8fRJDFpkg9ofxsK638voLNTzYgf9XMrg5XTbS9sRY HHlMSFC8VZ/P/5L7Lq0ld3o/bWoDgY1N+H3mHNPkSK9WX8ekeM+YW3v7hvf3/v1kSCBu 5/ZYh1BMAqC49Jvfn1KWjXjemGlIpOpUTkpWrAI/j8ycrSw1C6Pd8a0iqVYq2dTrg/KB SFSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687531452; x=1690123452; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vEoZ1jB1oL976vNVyEoQyhbzqpIzJpu70/dSSiTM/2s=; b=g6siwGnL0Vloattdc0t61lEzEcDR9UxFv8AG7dHvK3oBclyqy7QedENzqCbVH3J4tc QIe+/kDTROKoqJ0iUxiPCuKr1MWCPaFjIa2Q3tu57tztI0eAg45f1Vp5BIQxuCj3K1uK e3adcVS69mCRE4TZsJut5dZcxMm/YzMDy2HVgosZPdudCgtRoHpeelHBSjvCK9xXYrwO RUQfEXzQl/mTl7R3IWNjIYWH/E6onPLgRlaX5+pPkuTYIvkfCBDWCOHC6ZkQhXKhOBF1 QRjTLDrjoQzBjO+rLgfpnH6hqJ034ikKyIqWo/MMZ9Kgv32KvppKturoWWj8qX7bboND XsjA== X-Gm-Message-State: AC+VfDxcipNrSb/w5Ib4nRcAa/MLHaMlCeUHjyghjWLc5NT9H8+WQ+Ga 0OpxH8OZpIQsqFCqu6IptJygUKJl6UCPVNTuwAU= X-Received: by 2002:a5d:65c9:0:b0:311:1120:f2a1 with SMTP id e9-20020a5d65c9000000b003111120f2a1mr23919110wrw.46.1687531451891; Fri, 23 Jun 2023 07:44:11 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id p9-20020a1c7409000000b003f8d0308604sm2631707wmc.9.2023.06.23.07.44.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 07:44:11 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: Laurent Vivier Subject: [PATCH] linux-user: Remove pointless NULL check in clock_adjtime handling Date: Fri, 23 Jun 2023 15:44:10 +0100 Message-Id: <20230623144410.1837261-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In the code for TARGET_NR_clock_adjtime, we set the pointer phtx to the address of the local variable htx. This means it can never be NULL, but later in the code we check it for NULL anyway. Coverity complains about this (CID 1507683) because the NULL check comes after a call to clock_adjtime() that assumes it is non-NULL. Since phtx is always &htx, and is used only in three places, it's not really necessary. Remove it, bringing the code structure in to line with that for TARGET_NR_clock_adjtime64, which already uses a simple '&htx' when it wants a pointer to 'htx'. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- linux-user/syscall.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f2cb101d83c..7b2f9f7340e 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -10935,16 +10935,14 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, #if defined(TARGET_NR_clock_adjtime) && defined(CONFIG_CLOCK_ADJTIME) case TARGET_NR_clock_adjtime: { - struct timex htx, *phtx = &htx; + struct timex htx; - if (target_to_host_timex(phtx, arg2) != 0) { + if (target_to_host_timex(&htx, arg2) != 0) { return -TARGET_EFAULT; } - ret = get_errno(clock_adjtime(arg1, phtx)); - if (!is_error(ret) && phtx) { - if (host_to_target_timex(arg2, phtx) != 0) { - return -TARGET_EFAULT; - } + ret = get_errno(clock_adjtime(arg1, &htx)); + if (!is_error(ret) && host_to_target_timex(arg2, &htx)) { + return -TARGET_EFAULT; } } return ret;