Paul Burton 168b84d5d2 MIPS: Fix access_ok() for the last byte of user space
The MIPS implementation of access_ok() incorrectly reports that access
to the final byte of user memory is not OK, much as the alpha & SH
versions did prior to commit 94bd8a05cd4d ("Fix 'acccess_ok()' on alpha
and SH").

For example on a MIPS64 system with __UA_LIMIT == 0xffff000000000000 we
incorrectly fail in the following cases:

  access_ok(0xffffffffffff, 0x1) = 0
  access_ok(0xfffffffffffe, 0x2) = 0

Fix MIPS in the same way as alpha & SH, by subtracting one from the addr
+ size condition when size is non-zero. With this the access_ok() calls
above return 1 indicating that the access may be valid.

The cost of the improved check is pretty minimal - we gain 2410 bytes,
or 0.03%, in kernel code size for a 64r6el_defconfig kernel built using
GCC 8.1.0.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
2021-04-13 14:28:19 +02:00
..
2021-04-07 16:11:05 +02:00
2021-03-10 15:18:48 +01:00
2021-04-06 15:12:58 +02:00
2021-03-10 15:18:40 +01:00
2021-01-22 11:40:00 +01:00
2021-03-24 10:29:45 +01:00
2020-09-16 22:40:58 +02:00
2021-02-25 10:17:31 -08:00
2021-01-22 11:40:00 +01:00
2021-04-06 15:12:58 +02:00
2021-02-21 13:18:26 -08:00