This is a note to let you know that I've just added the patch titled

    tile: fix bug where fls(0) was not returning 0

to the 3.0-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     tile-fix-bug-where-fls-0-was-not-returning-0.patch
and it can be found in the queue-3.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 9f1d62bed7f015d11b9164078b7fea433b474114 Mon Sep 17 00:00:00 2001
From: Chris Metcalf <[email protected]>
Date: Fri, 25 May 2012 12:32:09 -0400
Subject: tile: fix bug where fls(0) was not returning 0

From: Chris Metcalf <[email protected]>

commit 9f1d62bed7f015d11b9164078b7fea433b474114 upstream.

This is because __builtin_clz(0) returns 64 for the "undefined" case
of 0, since the builtin just does a right-shift 32 and "clz" instruction.
So, use the alpha approach of casting to u32 and using __builtin_clzll().

Signed-off-by: Chris Metcalf <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 arch/tile/include/asm/bitops.h |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/arch/tile/include/asm/bitops.h
+++ b/arch/tile/include/asm/bitops.h
@@ -77,6 +77,11 @@ static inline int ffs(int x)
        return __builtin_ffs(x);
 }
 
+static inline int fls64(__u64 w)
+{
+       return (sizeof(__u64) * 8) - __builtin_clzll(w);
+}
+
 /**
  * fls - find last set bit in word
  * @x: the word to search
@@ -90,12 +95,7 @@ static inline int ffs(int x)
  */
 static inline int fls(int x)
 {
-       return (sizeof(int) * 8) - __builtin_clz(x);
-}
-
-static inline int fls64(__u64 w)
-{
-       return (sizeof(__u64) * 8) - __builtin_clzll(w);
+       return fls64((unsigned int) x);
 }
 
 static inline unsigned int __arch_hweight32(unsigned int w)


Patches currently in stable-queue which might be from [email protected] are

queue-3.0/tile-fix-bug-where-fls-0-was-not-returning-0.patch
queue-3.0/tilegx-enable-syscall_wrappers-support.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to