lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190227103230.GM32494@hirez.programming.kicks-ass.net>
Date:   Wed, 27 Feb 2019 11:32:30 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Ketan Patil <ketanp@...dia.com>
Cc:     mingo@...hat.com, linux-kernel@...r.kernel.org,
        linux-tegra@...r.kernel.org, snikam@...dia.com,
        bnihalani@...dia.com, byan@...dia.com, sgurrappadi@...dia.com,
        treding@...dia.com, talho@...dia.com
Subject: Re: [PATCH] sched/cputime: Remove unnecessary assignment statement

On Wed, Feb 27, 2019 at 11:43:22AM +0530, Ketan Patil wrote:
> The original code assigns the value from rtime to utime variable,
> and then jumps to the update label. And the value of utime is then
> updated, so the earlier value of utime is not used. Hence remove
> that unnecessary assignment statement.
> 
> This fixes one of the coverity defects.

Why does coverity care? I like the way the code is now, it makes
conceptual sense. Removing that assignment makes the code harder to read
and less symmetric (see the utime case right below).

Any sensible compiler will 'fix' this for us anyway.

> Based on work by Ishan Mittal <imittal@...dia.com>
> Signed-off-by: Ketan Patil <ketanp@...dia.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 ba4a143..ad64771 100644
> --- a/kernel/sched/cputime.c
> +++ b/kernel/sched/cputime.c
> @@ -616,10 +616,8 @@ void cputime_adjust(struct task_cputime *curr, struct prev_cputime *prev,
>  	 * Once a task gets some ticks, the monotonicy 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;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ