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] [day] [month] [year] [list]
Date:	Thu, 24 Mar 2011 19:41:03 +0200
From:	Alexey Dobriyan <adobriyan@...il.com>
To:	Michael Rodriguez <dkingston02@...il.com>
Cc:	tglx@...utronix.de, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kernel/itimer.c use ternary operators where appropriate
 and fix all style issues.

On Thu, Mar 24, 2011 at 01:26:03PM -0400, Michael Rodriguez wrote:
> @@ -33,12 +32,8 @@ static struct timeval itimer_get_remtime(struct hrtimer *timer)
>  	 * hrtimer_get_remtime() call but before this condition
>  	 * then we return 0 - which is correct.
>  	 */
> -	if (hrtimer_active(timer)) {
> -		if (rem.tv64 <= 0)
> -			rem.tv64 = NSEC_PER_USEC;
> -	} else
> -		rem.tv64 = 0;
> -
> +	rem.tv64 = ((hrtimer_active(timer) && rem.tv64 <= 0) ?
> +			NSEC_PER_USEC : 0);

NAK, not equivalent code.

>  	return ktime_to_timeval(rem);
>  }
>  
> @@ -57,17 +52,12 @@ static void get_cpu_itimer(struct task_struct *tsk, unsigned int clock_id,
>  		cputime_t t;
>  
>  		thread_group_cputimer(tsk, &cputime);
> -		if (clock_id == CPUCLOCK_PROF)
> -			t = cputime_add(cputime.utime, cputime.stime);
> -		else
> -			/* CPUCLOCK_VIRT */
> -			t = cputime.utime;
> -
> -		if (cputime_le(cval, t))
> -			/* about to fire */
> -			cval = cputime_one_jiffy;
> -		else
> -			cval = cputime_sub(cval, t);
> +
> +		t = (clock_id == CPUCLOCK_PROF) ? cputime_add(cputime.utime,
> +			cputime.stime) : cputime.utime;
> +
> +		cval = (cputime_le(cval, t) ? cputime_one_jiffy :
> +			cputime_sub(cval, t));

This code is not more readable than original one.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ