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-next>] [day] [month] [year] [list]
Date:   Fri, 24 Mar 2017 20:03:35 +0100
From:   Nicholas Mc Guire <der.herr@...r.at>
To:     John Stultz <john.stultz@...aro.org>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        "Christopher S. Hall" <christopher.s.hall@...el.com>,
        linux-kernel@...r.kernel.org, Nicholas Mc Guire <der.herr@...r.at>
Subject: [PATCH] timekeeping: no conversion to bool needed

As interp_forward is type bool assignment to a logical operation directly
is sufficient here.

Signed-off-by: Nicholas Mc Guire <der.herr@...r.at>
---

Found by coccinelle: boolconv.cocci
./kernel/time/timekeeping.c:1000:9-14: WARNING: conversion to bool not needed he
re
The explicit conversion to bool is not needed here as the logical operator
ensures that the right-side is a bool anyway.

Patch was compiletested with: x86_64_defconfig

Patch is against 4.11-rc3 (localversion-next is next-20170324)

 kernel/time/timekeeping.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 5b63a21..2921469 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -992,16 +992,15 @@ static int adjust_historical_crosststamp(struct system_time_snapshot *history,
 	bool interp_forward;
 	int ret;
 
 	if (total_history_cycles == 0 || partial_history_cycles == 0)
 		return 0;
 
 	/* Interpolate shortest distance from beginning or end of history */
-	interp_forward = partial_history_cycles > total_history_cycles/2 ?
-		true : false;
+	interp_forward = partial_history_cycles > total_history_cycles / 2;
 	partial_history_cycles = interp_forward ?
 		total_history_cycles - partial_history_cycles :
 		partial_history_cycles;
 
 	/*
 	 * Scale the monotonic raw time delta by:
 	 *	partial_history_cycles / total_history_cycles
-- 
2.1.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ