From: Greg Kroah-Hartman Date: Mon, 23 Aug 2021 23:59:21 +0000 (+1000) Subject: mm: change fault_in_pages_* to have an unsigned size parameter X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a8829ea678f708d0648270e8637b6730184b8fdb;p=users%2Fjedix%2Flinux-maple.git mm: change fault_in_pages_* to have an unsigned size parameter fault_in_pages_writeable() and fault_in_pages_readable() treat the size parameter as unsigned, doing pointer math with the value, so make this explicit and set it to be a size_t type which all callers currently treat it as anyway. This solves the issue where static checkers get nervous seeing pointer arithmetic happening with a signed value. Link: https://lkml.kernel.org/r/20210727111136.457638-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman Reported-by: Jordy Zomer Cc: Matthew Wilcox Cc: David Howells Cc: William Kucharski Cc: "Darrick J. Wong" Cc: Hugh Dickins Cc: Mauro Carvalho Chehab Signed-off-by: Andrew Morton Signed-off-by: Stephen Rothwell --- diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index b071babc6629..45f5ab7496cc 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -786,7 +786,7 @@ extern void add_page_wait_queue(struct page *page, wait_queue_entry_t *waiter); /* * Fault everything in given userspace address range in. */ -static inline int fault_in_pages_writeable(char __user *uaddr, int size) +static inline int fault_in_pages_writeable(char __user *uaddr, size_t size) { char __user *end = uaddr + size - 1; @@ -813,7 +813,7 @@ static inline int fault_in_pages_writeable(char __user *uaddr, int size) return 0; } -static inline int fault_in_pages_readable(const char __user *uaddr, int size) +static inline int fault_in_pages_readable(const char __user *uaddr, size_t size) { volatile char c; const char __user *end = uaddr + size - 1;