Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5350009imw; Wed, 20 Jul 2022 04:08:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sa7S16gOpjj1AnARf/U8j3Bh9KcCPX/ETdT12xZ/MGeCCUb3W2ZTPdfYs71/6hBEHJs421 X-Received: by 2002:a54:440b:0:b0:33a:a53c:5485 with SMTP id k11-20020a54440b000000b0033aa53c5485mr452903oiw.207.1658315311732; Wed, 20 Jul 2022 04:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658315311; cv=none; d=google.com; s=arc-20160816; b=ImrG/N/2yYLbhzIUBXbaD9ipvLoTCSo29wM2vPb9WWKZWH8kyFWNf9v95jC9pQ09HH X4k+6kAKqGECeIylblV9Wxfq3qzJ6yMaijJnA7ZOGS1lRM32mwAEnDZgPtZ5RGpLeQMQ Nn3IzvBpyr8KWD1HWNlzr4ZP5wGXIGmbR4J0sIsSWLNwOU8qyVctlRSWB1+414PlNfGK UPTNXPnLefT4CtEczN1KEAVWHhCOQKQUJBCBRnxIdKx4Nk5hmf9m5flonX8j1qYIoWAd zTQA3tVyJofmHh8OY75y4DoqCUAXbDwWrd6Q2Thg7CA0GOrCeM0DEEYxBZ63VEUQ03Ne rniA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ZxW8kn6VVBRo5Uc2b72nSYpwFmORwfNOni/4ua8JCsY=; b=qiDWjU08CtG/+8slR7HHJEp7r4U+g6hFfAlipB/Ji69riV3UJKi0Tpk6PH80owezuf x0pUgPibarb8biunGYFTGIjoNYxsXghCq3U0fIYElqQ0qoHEe+2FdDhjpYcejHw46MLg 7BLjr90YD5/G90LCauIbIJETd8ErD7H8GBzrZhhrxbkTcc3FV+Zie006UsK7SrGEMDQ8 9gfmCMW4uN00IB/HseFWqzFRkoR43dkPfhF8U/1Cy9nOJtLWfLbyUm9lroRNcYcsNLlK Lcw1fzscYH1NOqglwkVDGm/Z5qa5ufeMtCLEr9s3YjUTLN9P+EFmtXOuYaW0vqr9HsKR zb5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="BMXf+Mn/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a14-20020a056808120e00b003352538ff30si17002860oil.43.2022.07.20.04.08.18; Wed, 20 Jul 2022 04:08:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="BMXf+Mn/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239329AbiGTKaM (ORCPT + 99 others); Wed, 20 Jul 2022 06:30:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235258AbiGTKaK (ORCPT ); Wed, 20 Jul 2022 06:30:10 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6FCC1105 for ; Wed, 20 Jul 2022 03:30:09 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id g4so16041560pgc.1 for ; Wed, 20 Jul 2022 03:30:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZxW8kn6VVBRo5Uc2b72nSYpwFmORwfNOni/4ua8JCsY=; b=BMXf+Mn/8zj/5LTJNdVq/S4TPSqgI1IaFeSH6OeRbDncbh9VoSjAtn229c64YRy/pf uInBPTRek5Oh/dgcRZ6GeuvjP1sTGA+TuPwhapjlzVTUos+xk8Vt3RhXw37dZR5DAZg3 C7Q04yIzSvEejKT0QVivIFIoJ3SmKK172S6RuGEph9jR2lxaw5k7htO4yv3U5BXC59WE 4PcICIhkxj+7cXcmvkapUWx+CXNeAl1q1N1oTkwbpveOV8Wbo2L5lcmPaB4Ut2oTWxbE Au8l17EeUiX2uljAUdVkLU32duDZu3uE5RaOPIRwQS4pXMvXn6NlosmubeuxijODopAu jBug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZxW8kn6VVBRo5Uc2b72nSYpwFmORwfNOni/4ua8JCsY=; b=Lhl4CnSyFiZR0HrotxEvf6mxt95XPC/2RTJOQEKSFY30VT44SKI70Xvo9Fq2goiR8K we4K3c7tU4JjcucMukWYN+Y0SC0vAEEg0lOST95P1DixsTwyXe9W32ciL76vswkM5Vyj pC3BLsVMwFng+sIDLHFx5FBC7Jc1zmtA0OH12R+EWGKuSkTolXEFC3ONLAv2kguCSPLb KibikD6z7y/gQ20CDiXvD1IHpgz/wgnOSEagY68iHrHZcDvGM52V1HE6V5zJ9V6ezq6v y5ltEaQEaG37kwws8854E6NEshOjY7NAY6gt+JqI6SJQl6DHVP1QmPtF4GYKdtvhDuB/ rP0w== X-Gm-Message-State: AJIora8BnyDyvrs58nFYiOV1NIk/gapM8DyJmyiIPIx/tZM5WX4BUQSH 208NjKvosl1fKCkbJCMZJDTnx3n7SCkkBhCUeSc= X-Received: by 2002:a05:6a00:21c8:b0:4fd:f89f:ec0e with SMTP id t8-20020a056a0021c800b004fdf89fec0emr38673114pfj.83.1658313009237; Wed, 20 Jul 2022 03:30:09 -0700 (PDT) Received: from localhost.localdomain ([43.132.141.9]) by smtp.gmail.com with ESMTPSA id m11-20020a170902db0b00b0016c4147e48asm13667220plx.219.2022.07.20.03.30.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 03:30:08 -0700 (PDT) From: zengjx95@gmail.com To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com Cc: linux-kernel@vger.kernel.org, Zeng Jingxiang Subject: [PATCH] kernel/sched/cputime: Fix unused value in cputime_adjust() Date: Wed, 20 Jul 2022 18:29:56 +0800 Message-Id: <20220720102956.1141634-1-zengjx95@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zeng Jingxiang Coverity warns uf an unused value: assigned_value: Assign the value of the variable rtime to utime here, but that stored value is overwritten before it can be used. 568 if (stime == 0) { 569 utime = rtime; 570 goto update; 571 } value_overwrite: Overwriting previous write to utime with the value of expression rtime - stime. 592 utime = rtime - stime; Signed-off-by: Zeng Jingxiang --- kernel/sched/cputime.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index 78a233d43757..531df8b29e6d 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c @@ -565,10 +565,8 @@ void cputime_adjust(struct task_cputime *curr, struct prev_cputime *prev, * Once a task gets some ticks, the monotonicity code at 'update:' * will ensure things converge to the observed ratio. */ - if (stime == 0) { - utime = rtime; + if (stime == 0) goto update; - } if (utime == 0) { stime = rtime; -- 2.27.0