arm: fix inline asm in load_unaligned_zeropad()
Subsystems (2)
PATCH 1/1 arm: fix inline asm in load_unaligned_zeropad()
The inline asm's addr operand is marked as input-only, however in the case where an exception is taken it may be modified by the BIC instruction on the exception path. Fix the problem by using a temporary register as the destination register for the BIC instruction.
--- arch/arm/include/asm/word-at-a-time.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/include/asm/word-at-a-time.h +5 -5
@@ -66,7 +66,7 @@ static inline unsigned long find_zero(unsigned long mask)*/ static inline unsigned long load_unaligned_zeropad (const void *addr) { -unsigned long ret, offset; +unsigned long ret, tmp;/* Load word from unaligned pointer addr */ asm(
@@ -74,9 +74,9 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)"2:\n" " .pushsection .text.fixup,\"ax\"\n" " .align 2\n" -"3: and %1, %2, #0x3\n" -" bic %2, %2, #0x3\n" -" ldr %0, [%2]\n" +"3: bic %1, %2, #0x3\n" +" ldr %0, [%1]\n" +" and %1, %2, #0x3\n" " lsl %1, %1, #0x3\n" #ifndef __ARMEB__" lsr %0, %0, %1\n"
@@ -89,7 +89,7 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)" .align 3\n" " .long 1b, 3b\n" " .popsection" - : "=&r" (ret), "=&r" (offset) + : "=&r" (ret), "=&r" (tmp) : "r" (addr), "Qo" (*(unsigned long *)addr)); return ret;
Signature · 7 lines
2.31.0.291.g576ba9dcdaf-goog _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 11 lines · Peter Collingbourne
The inline asm's addr operand is marked as input-only, however in the case where an exception is taken it may be modified by the BIC instruction on the exception path. Fix the problem by using a temporary register as the destination register for the BIC instruction.
Signed-off-by Peter Collingbourne <[email protected]>--- arch/arm/include/asm/word-at-a-time.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Please can you put this into Russell's patch system?
Thanks,
Will
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel