Merge "mm/usercopy: Use memory range to be accessed for wraparound check"

This commit is contained in:
qctecmdr Service 2019-01-11 21:02:38 -08:00 committed by Gerrit - the friendly Code Review server
commit fab1a14a60

View file

@ -151,7 +151,7 @@ static inline void check_bogus_address(const unsigned long ptr, unsigned long n,
bool to_user)
{
/* Reject if object wraps past end of memory. */
if (ptr + n < ptr)
if (ptr + (n - 1) < ptr)
usercopy_abort("wrapped address", NULL, to_user, 0, ptr + n);
/* Reject if NULL or ZERO-allocation. */