Skip to content

Commit e15710b

Browse files
gregkhtorvalds
authored andcommitted
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/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]> Reported-by: Jordy Zomer <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: David Howells <[email protected]> Cc: William Kucharski <[email protected]> Cc: "Darrick J. Wong" <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent f00230f commit e15710b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/linux/pagemap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ extern void add_page_wait_queue(struct page *page, wait_queue_entry_t *waiter);
736736
/*
737737
* Fault everything in given userspace address range in.
738738
*/
739-
static inline int fault_in_pages_writeable(char __user *uaddr, int size)
739+
static inline int fault_in_pages_writeable(char __user *uaddr, size_t size)
740740
{
741741
char __user *end = uaddr + size - 1;
742742

@@ -763,7 +763,7 @@ static inline int fault_in_pages_writeable(char __user *uaddr, int size)
763763
return 0;
764764
}
765765

766-
static inline int fault_in_pages_readable(const char __user *uaddr, int size)
766+
static inline int fault_in_pages_readable(const char __user *uaddr, size_t size)
767767
{
768768
volatile char c;
769769
const char __user *end = uaddr + size - 1;

0 commit comments

Comments
 (0)