Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xtensa: fix str[n]cmp return value

str[n]cmp functions return negative value if the first string is less
than the second, positive value if the first string is greater than the
second and zero if they are equal. This is important when these
functions are used for sorting/binary search.

With incorrect strcmp return value bsearch was always failing in the
find_symbol_in_section making it impossible to load any module.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>

authored by

Max Filippov and committed by
Chris Zankel
c5a285bb de73b6b1

+2 -2
+2 -2
arch/xtensa/include/asm/string.h
··· 74 74 "beqz %2, 2f\n\t" 75 75 "beq %2, %3, 1b\n" 76 76 "2:\n\t" 77 - "sub %2, %3, %2" 77 + "sub %2, %2, %3" 78 78 : "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&r" (__dummy) 79 79 : "0" (__cs), "1" (__ct)); 80 80 ··· 99 99 "beqz %3, 2f\n\t" 100 100 "beq %2, %3, 1b\n" 101 101 "2:\n\t" 102 - "sub %2, %3, %2" 102 + "sub %2, %2, %3" 103 103 : "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&r" (__dummy) 104 104 : "0" (__cs), "1" (__ct), "r" (__cs+__n)); 105 105