mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
uaccess: fix type mismatch warnings from access_ok()
On some architectures, access_ok() does not do any argument type checking, so replacing the definition with a generic one causes a few warnings for harmless issues that were never caught before. Fix the ones that I found either through my own test builds or that were reported by the 0-day bot. Reported-by: kernel test robot <lkp@intel.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Acked-by: Dinh Nguyen <dinguyen@kernel.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
@@ -417,8 +417,8 @@ static bool test_kernel_ptr(unsigned long addr, int size)
|
||||
return false;
|
||||
|
||||
/* should be at least readable kernel address */
|
||||
if (access_ok(ptr, 1) ||
|
||||
access_ok(ptr + size - 1, 1) ||
|
||||
if (access_ok((void __user *)ptr, 1) ||
|
||||
access_ok((void __user *)ptr + size - 1, 1) ||
|
||||
get_kernel_nofault(buf, ptr) ||
|
||||
get_kernel_nofault(buf, ptr + size - 1)) {
|
||||
pr_err("invalid kernel ptr: %#lx\n", addr);
|
||||
|
||||
Reference in New Issue
Block a user