[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220720102956.1141634-1-zengjx95@gmail.com>
Date: Wed, 20 Jul 2022 18:29:56 +0800
From: zengjx95@...il.com
To: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
bristot@...hat.com, vschneid@...hat.com
Cc: linux-kernel@...r.kernel.org,
Zeng Jingxiang <linuszeng@...cent.com>
Subject: [PATCH] kernel/sched/cputime: Fix unused value in cputime_adjust()
From: Zeng Jingxiang <linuszeng@...cent.com>
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 <linuszeng@...cent.com>
---
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
Powered by blists - more mailing lists