]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.36.2/arm-6482-2-fix-find_next_zero_bit-and-related-assembly.patch
Remove duplicated commits
[thirdparty/kernel/stable-queue.git] / releases / 2.6.36.2 / arm-6482-2-fix-find_next_zero_bit-and-related-assembly.patch
CommitLineData
d9b1f36d
GKH
1From 0e91ec0c06d2cd15071a6021c94840a50e6671aa Mon Sep 17 00:00:00 2001
2From: James Jones <jajones@nvidia.com>
3Date: Wed, 24 Nov 2010 00:21:37 +0100
4Subject: ARM: 6482/2: Fix find_next_zero_bit and related assembly
5
6From: James Jones <jajones@nvidia.com>
7
8commit 0e91ec0c06d2cd15071a6021c94840a50e6671aa upstream.
9
10The find_next_bit, find_first_bit, find_next_zero_bit
11and find_first_zero_bit functions were not properly
12clamping to the maxbit argument at the bit level. They
13were instead only checking maxbit at the byte level.
14To fix this, add a compare and a conditional move
15instruction to the end of the common bit-within-the-
16byte code used by all the functions and be sure not to
17clobber the maxbit argument before it is used.
18
19Reviewed-by: Nicolas Pitre <nicolas.pitre@linaro.org>
20Tested-by: Stephen Warren <swarren@nvidia.com>
21Signed-off-by: James Jones <jajones@nvidia.com>
22Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
23Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
24
25---
26 arch/arm/lib/findbit.S | 6 ++++--
27 1 file changed, 4 insertions(+), 2 deletions(-)
28
29--- a/arch/arm/lib/findbit.S
30+++ b/arch/arm/lib/findbit.S
31@@ -174,8 +174,8 @@ ENDPROC(_find_next_bit_be)
32 */
33 .L_found:
34 #if __LINUX_ARM_ARCH__ >= 5
35- rsb r1, r3, #0
36- and r3, r3, r1
37+ rsb r0, r3, #0
38+ and r3, r3, r0
39 clz r3, r3
40 rsb r3, r3, #31
41 add r0, r2, r3
42@@ -190,5 +190,7 @@ ENDPROC(_find_next_bit_be)
43 addeq r2, r2, #1
44 mov r0, r2
45 #endif
46+ cmp r1, r0 @ Clamp to maxbit
47+ movlo r0, r1
48 mov pc, lr
49