Commit 00977610 authored by Ralf Baechle's avatar Ralf Baechle

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: default avatarRalf Baechle <ralf@linux-mips.org>
parent 30fa0530
...@@ -40,9 +40,11 @@ FEXPORT(__strnlen_\func\()_nocheck_asm) ...@@ -40,9 +40,11 @@ FEXPORT(__strnlen_\func\()_nocheck_asm)
.else .else
EX(lbe, t0, (v0), .Lfault\@) EX(lbe, t0, (v0), .Lfault\@)
.endif .endif
PTR_ADDIU v0, 1 .set noreorder
bnez t0, 1b bnez t0, 1b
1: PTR_SUBU v0, a0 1: PTR_ADDIU v0, 1
.set reorder
PTR_SUBU v0, a0
jr ra jr ra
END(__strnlen_\func\()_asm) END(__strnlen_\func\()_asm)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment