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

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>

+4 -2
+4 -2
arch/mips/lib/strnlen_user.S
··· 40 40 .else 41 41 EX(lbe, t0, (v0), .Lfault\@) 42 42 .endif 43 - PTR_ADDIU v0, 1 43 + .set noreorder 44 44 bnez t0, 1b 45 - 1: PTR_SUBU v0, a0 45 + 1: PTR_ADDIU v0, 1 46 + .set reorder 47 + PTR_SUBU v0, a0 46 48 jr ra 47 49 END(__strnlen_\func\()_asm) 48 50