All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usercopy: use unsigned long instead of uintptr_t
@ 2022-06-16 14:36 Jason A. Donenfeld
  2022-06-16 14:38 ` Matthew Wilcox
  2022-06-16 16:29 ` Kees Cook
  0 siblings, 2 replies; 17+ messages in thread
From: Jason A. Donenfeld @ 2022-06-16 14:36 UTC (permalink / raw)
  To: linux-mm, linux-xfs, linux-hardening, linux-kernel
  Cc: Jason A. Donenfeld, Matthew Wilcox, Uladzislau Rezki, Kees Cook,
	Greg Kroah-Hartman, Linus Torvalds, Joe Perches

A recent commit factored out a series of annoying (unsigned long) casts
into a single variable declaration, but made the pointer type a
`uintptr_t` rather than the usual `unsigned long`. This patch changes it
to be the integer type more typically used by the kernel to represent
addresses.

Fixes: 35fb9ae4aa2e ("usercopy: Cast pointer to an integer once")
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Uladzislau Rezki <urezki@gmail.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 mm/usercopy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/usercopy.c b/mm/usercopy.c
index 4e1da708699b..c1ee15a98633 100644
--- a/mm/usercopy.c
+++ b/mm/usercopy.c
@@ -161,7 +161,7 @@ static inline void check_bogus_address(const unsigned long ptr, unsigned long n,
 static inline void check_heap_object(const void *ptr, unsigned long n,
 				     bool to_user)
 {
-	uintptr_t addr = (uintptr_t)ptr;
+	unsigned long addr = (unsigned long)ptr;
 	unsigned long offset;
 	struct folio *folio;
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-06-17 12:51 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16 14:36 [PATCH] usercopy: use unsigned long instead of uintptr_t Jason A. Donenfeld
2022-06-16 14:38 ` Matthew Wilcox
2022-06-16 14:51   ` Jason A. Donenfeld
2022-06-16 15:11     ` Jason A. Donenfeld
2022-06-16 15:21     ` Matthew Wilcox
2022-06-16 15:59       ` Linus Torvalds
2022-06-16 16:12         ` Linus Torvalds
2022-06-16 16:44         ` Matthew Wilcox
2022-06-16 16:56           ` Linus Torvalds
2022-06-16 19:14             ` Linus Torvalds
2022-06-16 19:18               ` Linus Torvalds
2022-06-17  9:19                 ` David Laight
2022-06-17  7:58               ` Geert Uytterhoeven
2022-06-17 11:05                 ` Christophe Leroy
2022-06-17 12:51                   ` David Laight
2022-06-16 16:29 ` Kees Cook
2022-06-16 16:36   ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.