[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210727111136.457638-1-gregkh@linuxfoundation.org>
Date: Tue, 27 Jul 2021 13:11:36 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: willy@...radead.org, akpm@...ux-foundation.org
Cc: linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jordy Zomer <jordy@...ing.systems>,
David Howells <dhowells@...hat.com>,
William Kucharski <william.kucharski@...cle.com>,
"Darrick J. Wong" <djwong@...nel.org>,
Hugh Dickins <hughd@...gle.com>,
Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
Subject: [PATCH] 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.
Reported-by: Jordy Zomer <jordy@...ing.systems>
Cc: Matthew Wilcox <willy@...radead.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: David Howells <dhowells@...hat.com>
Cc: William Kucharski <william.kucharski@...cle.com>
Cc: "Darrick J. Wong" <djwong@...nel.org>
Cc: Hugh Dickins <hughd@...gle.com>
Cc: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
include/linux/pagemap.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index ed02aa522263..5dcf446f42e5 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -736,7 +736,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;
@@ -763,7 +763,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;
--
2.32.0
Powered by blists - more mailing lists