From patchwork Mon Jul 17 12:47:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 703718 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e4d:0:b0:314:25da:8dc4 with SMTP id r13csp979720wrt; Mon, 17 Jul 2023 05:52:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlHn/A2p/XAX+EZySbaob3xLSVr3v+4OMxjCpfO8rqygI+jCi4+SM223Zfe2m4sxhtUOpoG4 X-Received: by 2002:a05:620a:469e:b0:767:400b:bbca with SMTP id bq30-20020a05620a469e00b00767400bbbcamr11041456qkb.48.1689598369503; Mon, 17 Jul 2023 05:52:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689598369; cv=none; d=google.com; s=arc-20160816; b=slYC8+vR6EgsSDI1NZ5dXwpXOjZimDwAhdTVgBQi1aNq0ld9TfzEmQDlG+XtXcDU93 fvlRjKMgxL7RAxsn9uXxZmmvPdUx82uN0bEIFx0B+qS3FHoq+Wgg+yqRmt8P2nW6oLHY vSJvUfrISwX+1M9anYvbuO7Z3T9vzTBwSBn0zIwLJRLaYqfjL5pEASYZMK3ekHzPBGyK HTUShaF2sM1WR5/RTZwOE37gMRcrqkqqR9xhL2sI9APGmomMfNc7jwiwFrXJg87hk4qL 2/ZOoMEDL7MW8nfspahUjH/c/ztbmodsjsQqVTgFAtycoDATXOaMQcPNwvp6cES5GPj6 w/8A== 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:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=+E+optEz0nYwCwN2hJQhLLatmGokjisG+592zq4NO/8=; fh=bFDrUYhlTVi/QyetgXx/byg2+yO/22Hp9SjwoefyKLk=; b=cDK3VB74sR/PyApFAsr9GJ5bCdsF2kPrbB/SqxPiC/KgFrk1HF5d9HEoIl2mzuMmQ6 +YTWRjefs+N+WBY8zo1zXHCuCvvMYjeE4rE59y7SQgAkm95INZC86N2rjC7uocHEucm3 BenJG1X29C7FBDRBVlp3EYVQ5nF7M/s1XYsMUfhHVDwLhnR4ZHSq/LVIPopwtpx+Q+6l pw2mkAR+xQn3CbR9XbU1NaASJSlBIilXlxgVPHSGXd4KmFT4Nu0VEDamLmcZficnIN9I QKiE2lM1fcmPwK/npYs8zc2HH7beHCLfi8wWTyDfEUePN9p3CpiHhYGuEd0pYyIav9pr uAXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ivq7E0ZQ; 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 i10-20020a05620a144a00b007680f009115si2779369qkl.393.2023.07.17.05.52.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Jul 2023 05:52:49 -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=Ivq7E0ZQ; 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 1qLNhw-00040X-Oz; Mon, 17 Jul 2023 08:52:09 -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 1qLNdr-0008RX-QA for qemu-devel@nongnu.org; Mon, 17 Jul 2023 08:47:58 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qLNdm-0008T5-Ag for qemu-devel@nongnu.org; Mon, 17 Jul 2023 08:47:55 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fbea147034so40886155e9.0 for ; Mon, 17 Jul 2023 05:47:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689598069; x=1692190069; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=+E+optEz0nYwCwN2hJQhLLatmGokjisG+592zq4NO/8=; b=Ivq7E0ZQ29pk7V0StaXJ8b61sMdqQG7h2pNDu7n3qZCpESOR97i9KtIqSq5rWL4Q6J N5ETYcURe6o6Wh5ZhV2DO/fzI/HhXIK+qZBeA3vHz07vy+zqwQsSNhMAOPrAh31D1Q7Z yTmVx5UAGfvpPp80LXbrSCjtdgYJD4QTi5TbMd2jNdULw67TV7IbYWVOpvbP/AFLGMdJ wTk8tzEaWuS7aFZgmt0aoBqXFAsNqirszpBIdXeuCB1GM4I31+eEmzK5NfiYR8nI2Sx4 zrqR6vElpyTfiboOnlrS4t5BfI9G88I3E92DpXh54TwzrKbufp8ZnIldh7DlPPJfUQYH pWtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689598069; x=1692190069; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+E+optEz0nYwCwN2hJQhLLatmGokjisG+592zq4NO/8=; b=IwMw/q70W0Cq21rsIJr4Acv7oFLvOsHTFcODGM/cJ61/b/j1yCNax1V4TDR99SDqBt Wvw6OcSowcJs/b70y1wuh38vjqzoOFOhFNggxI6kY+Ktn5wOUFb71bphOusMMjaniC2Y 28r71FX9Mi365hW23ZzZoWhQ+xQDzMkF/M4l/3Va7TxqvgeMsrWmcnFEt0syYhXE9e+l MXWfkAazM6f2VnvD9VWTxCzf8tB7jV7rfPG/g8S0mrfjYZnH7ASprplEfnCQXg98LUZY Z87p8ZeOfs5wJHtMYFyFGO52ywWQ9dF4EGET2G0c7OzqeHLHUQHPh+NTxBDTm1PFe7bg jCVw== X-Gm-Message-State: ABy/qLY+BJX4nmIpUwmnHgsv6QsVli5qNz/akAnpVk+e7gre3hLDz6D6 TSVJOfIJ2GBgpWbFe5jeoxWwvHETiGSfonqX5Kw= X-Received: by 2002:adf:eec7:0:b0:314:4925:1704 with SMTP id a7-20020adfeec7000000b0031449251704mr9840535wrp.6.1689598068791; Mon, 17 Jul 2023 05:47:48 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v16-20020a5d6790000000b003112ab916cdsm19337737wru.73.2023.07.17.05.47.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 05:47:48 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 2/7] linux-user: Remove pointless NULL check in clock_adjtime handling Date: Mon, 17 Jul 2023 13:47:41 +0100 Message-Id: <20230717124746.759085-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230717124746.759085-1-peter.maydell@linaro.org> References: <20230717124746.759085-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=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 Message-id: 20230623144410.1837261-1-peter.maydell@linaro.org --- 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 14641518262..c99ef9c01ef 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -11190,16 +11190,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;