diff options
author | Paul Mackerras <paulus@samba.org> | 2012-05-27 22:59:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-27 23:59:46 -0400 |
commit | 69ea6405980f217557b6a58f70ff60d8d88519a5 (patch) | |
tree | d5e2b702e0226465d6962a28d1406c2deeb9fedd /lib | |
parent | 1e2aec873ad6d16538512dbb96853caa1fa076af (diff) |
lib: Fix generic strnlen_user for 32-bit big-endian machines
The aligned_byte_mask() definition is wrong for 32-bit big-endian
machines: the "7-(n)" part of the definition assumes a long is 8
bytes. This fixes it by using BITS_PER_LONG - 8 instead of 8*7.
Tested on 32-bit and 64-bit PowerPC.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/strnlen_user.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c index 90900ecfeb54..a28df5206d95 100644 --- a/lib/strnlen_user.c +++ b/lib/strnlen_user.c | |||
@@ -8,7 +8,7 @@ | |||
8 | #ifdef __LITTLE_ENDIAN | 8 | #ifdef __LITTLE_ENDIAN |
9 | # define aligned_byte_mask(n) ((1ul << 8*(n))-1) | 9 | # define aligned_byte_mask(n) ((1ul << 8*(n))-1) |
10 | #else | 10 | #else |
11 | # define aligned_byte_mask(n) (~0xfful << 8*(7-(n))) | 11 | # define aligned_byte_mask(n) (~0xfful << (BITS_PER_LONG - 8 - 8*(n))) |
12 | #endif | 12 | #endif |
13 | 13 | ||
14 | /* | 14 | /* |