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: <tip-3e17510cbc3e75cae0c96fa38ca469ffe754aedf@git.kernel.org>
Date:	Sun, 11 Oct 2015 13:09:56 -0700
From:	tip-bot for Rasmus Villemoes <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	tglx@...utronix.de, mingo@...nel.org, linux@...musvillemoes.dk,
	linux-kernel@...r.kernel.org, hpa@...or.com, john.stultz@...aro.org
Subject: [tip:timers/core] timers: Use __fls in apply_slack()

Commit-ID:  3e17510cbc3e75cae0c96fa38ca469ffe754aedf
Gitweb:     http://git.kernel.org/tip/3e17510cbc3e75cae0c96fa38ca469ffe754aedf
Author:     Rasmus Villemoes <linux@...musvillemoes.dk>
AuthorDate: Fri, 2 Oct 2015 09:45:30 +0200
Committer:  Thomas Gleixner <tglx@...utronix.de>
CommitDate: Sun, 11 Oct 2015 22:07:23 +0200

timers: Use __fls in apply_slack()

In apply_slack(), find_last_bit() is applied to a bitmask consisting
of precisely BITS_PER_LONG bits. Since mask is non-zero, we might as
well eliminate the function call and use __fls() directly. On x86_64,
this shaves 23 bytes of the only caller, mod_timer().

This also gets rid of Coverity CID 1192106, but that is a false
positive: Coverity is not aware that mask != 0 implies that
find_last_bit will not return BITS_PER_LONG.

Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: John Stultz <john.stultz@...aro.org>
Link: http://lkml.kernel.org/r/1443771931-6284-1-git-send-email-linux@rasmusvillemoes.dk
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
---
 kernel/time/timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index d3f5e92..74591ba 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -874,7 +874,7 @@ unsigned long apply_slack(struct timer_list *timer, unsigned long expires)
 	if (mask == 0)
 		return expires;
 
-	bit = find_last_bit(&mask, BITS_PER_LONG);
+	bit = __fls(mask);
 
 	mask = (1UL << bit) - 1;
 
--
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