diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2014-11-04 13:54:29 +0300 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-11-04 14:46:33 +0300 |
commit | 0097761013253930341e23723d64e0845c3f9edd (patch) | |
tree | b0a8e44f720c2966e5c545f0cff5a638593cfb95 /arch/mips | |
parent | 30fa0530ff87f6379e046629adfa3f4872a2d353 (diff) | |
download | linux-0097761013253930341e23723d64e0845c3f9edd.tar.xz |
MIPS: Fix strnlen_user() return value in case of overlong strings.
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>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/lib/strnlen_user.S | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/mips/lib/strnlen_user.S b/arch/mips/lib/strnlen_user.S index f3af6995e2a6..7d12c0dded3d 100644 --- a/arch/mips/lib/strnlen_user.S +++ b/arch/mips/lib/strnlen_user.S @@ -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) |