1 From 0e91ec0c06d2cd15071a6021c94840a50e6671aa Mon Sep 17 00:00:00 2001
2 From: James Jones <jajones@nvidia.com>
3 Date: Wed, 24 Nov 2010 00:21:37 +0100
4 Subject: ARM: 6482/2: Fix find_next_zero_bit and related assembly
6 From: James Jones <jajones@nvidia.com>
8 commit 0e91ec0c06d2cd15071a6021c94840a50e6671aa upstream.
10 The find_next_bit, find_first_bit, find_next_zero_bit
11 and find_first_zero_bit functions were not properly
12 clamping to the maxbit argument at the bit level. They
13 were instead only checking maxbit at the byte level.
14 To fix this, add a compare and a conditional move
15 instruction to the end of the common bit-within-the-
16 byte code used by all the functions and be sure not to
17 clobber the maxbit argument before it is used.
19 Reviewed-by: Nicolas Pitre <nicolas.pitre@linaro.org>
20 Tested-by: Stephen Warren <swarren@nvidia.com>
21 Signed-off-by: James Jones <jajones@nvidia.com>
22 Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
26 arch/arm/lib/findbit.S | 6 ++++--
27 1 file changed, 4 insertions(+), 2 deletions(-)
29 --- a/arch/arm/lib/findbit.S
30 +++ b/arch/arm/lib/findbit.S
31 @@ -174,8 +174,8 @@ ENDPROC(_find_next_bit_be)
34 #if __LINUX_ARM_ARCH__ >= 5
42 @@ -190,5 +190,7 @@ ENDPROC(_find_next_bit_be)
46 + cmp r1, r0 @ Clamp to maxbit