MIPS: Fix strnlen_user() return value in case of overlong strings.
authorRalf Baechle <ralf@linux-mips.org>
Tue, 4 Nov 2014 10:54:29 +0000 (11:54 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 4 Nov 2014 11:46:33 +0000 (12:46 +0100)
We were returning maxlen like the userland strnlen if no '\0' character
was encountered while the kernel version is expected to return a value
larger than maxlen.  Fixed to return maxlen + 1.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/lib/strnlen_user.S

index f3af6995e2a6e9546175add0d38d0b555ecd1b61..7d12c0dded3ded2009f85ffd7ed7d6e52f645c0c 100644 (file)
@@ -40,9 +40,11 @@ FEXPORT(__strnlen_\func\()_nocheck_asm)
 .else
        EX(lbe, t0, (v0), .Lfault\@)
 .endif
-       PTR_ADDIU       v0, 1
+       .set            noreorder
        bnez            t0, 1b
-1:     PTR_SUBU        v0, a0
+1:      PTR_ADDIU      v0, 1
+       .set            reorder
+       PTR_SUBU        v0, a0
        jr              ra
        END(__strnlen_\func\()_asm)