[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAPp=jc8wdLd7rZGuun3FH6k2nDMsfMLHF94M=ZOjbaEFvS6WRQ@mail.gmail.com>
Date: Wed, 20 Jul 2022 20:25:37 +0800
From: jingxiang zeng <zengjx95@...il.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: mingo@...hat.com, 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,
linux-kernel@...r.kernel.org,
Zeng Jingxiang <linuszeng@...cent.com>
Subject: Re: [PATCH] kernel/sched/cputime: Fix unused value in cputime_adjust()
Peter Zijlstra <peterz@...radead.org> 于2022年7月20日周三 19:33写道:
>
> On Wed, Jul 20, 2022 at 06:29:56PM +0800, zengjx95@...il.com wrote:
> > 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;
>
> Coverity is being daft, the compiler has a dead-store-elimination pass.
>
> This way the code is more consistent / easier to ready.
Thank you for your suggestion, I will try it.
Powered by blists - more mailing lists