-stable review patch. If anyone has any objections, please let us know.
---------------------
From: Rolf Eike Beer <[email protected]>
Fix roundup_pow_of_two(1)
1 is a power of two, therefore roundup_pow_of_two(1) should return 1. It does
in case the argument is a variable but in case it's a constant it behaves
wrong and returns 0. Probably nobody ever did it so this was never noticed.
Signed-off-by: Rolf Eike Beer <[email protected]>
Signed-off-by: Chris Wright <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
include/linux/log2.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- linux-2.6.21.4.orig/include/linux/log2.h
+++ linux-2.6.21.4/include/linux/log2.h
@@ -159,7 +159,7 @@ unsigned long __roundup_pow_of_two(unsig
#define roundup_pow_of_two(n) \
( \
__builtin_constant_p(n) ? ( \
- (n == 1) ? 0 : \
+ (n == 1) ? 1 : \
(1UL << (ilog2((n) - 1) + 1)) \
) : \
__roundup_pow_of_two(n) \
--
On Fri, Jun 08, 2007 at 12:22:01AM -0700, Chris Wright wrote:
> -stable review patch. If anyone has any objections, please let us know.
> ---------------------
>
> From: Rolf Eike Beer <[email protected]>
>
> Fix roundup_pow_of_two(1)
>
> 1 is a power of two, therefore roundup_pow_of_two(1) should return 1. It does
> in case the argument is a variable but in case it's a constant it behaves
> wrong and returns 0. Probably nobody ever did it so this was never noticed.
If this doesn't fix a user-visiable bug, should we be including it in
the stable patch series? (Assuming that it doesn't, I wouldn't, but I
tend to be more conservative about what I would include in a stable
production release.)
Regards,
- Ted
* Theodore Tso ([email protected]) wrote:
> If this doesn't fix a user-visiable bug, should we be including it in
> the stable patch series? (Assuming that it doesn't, I wouldn't, but I
> tend to be more conservative about what I would include in a stable
> production release.)
Rolf, despite simplicity of patch, I'm inclined to agree with Ted.
Were you effected by this in the wild, or just noticed by code
inspection?
thanks,
-chris
Chris Wright wrote:
> * Theodore Tso ([email protected]) wrote:
> > If this doesn't fix a user-visiable bug, should we be including it in
> > the stable patch series? (Assuming that it doesn't, I wouldn't, but I
> > tend to be more conservative about what I would include in a stable
> > production release.)
>
> Rolf, despite simplicity of patch, I'm inclined to agree with Ted.
> Were you effected by this in the wild, or just noticed by code
> inspection?
Code inspection. Drop it if you like, it's in mainline already.