Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1628377 > unrolled thread

[PATCH] mm: gup: fix access_ok() argument type

Started byArnd Bergmann <arnd@arndb.de>
First post2017-04-21 19:10 +0200
Last post2017-04-23 11:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] mm: gup: fix access_ok() argument type Arnd Bergmann <arnd@arndb.de> - 2017-04-21 19:10 +0200
    Re: [PATCH] mm: gup: fix access_ok() argument type Ingo Molnar <mingo@kernel.org> - 2017-04-23 11:30 +0200

#1628377 — [PATCH] mm: gup: fix access_ok() argument type

FromArnd Bergmann <arnd@arndb.de>
Date2017-04-21 19:10 +0200
Subject[PATCH] mm: gup: fix access_ok() argument type
Message-ID<tyKef-8vc-49@gated-at.bofh.it>
MIPS just got changed to only accept a pointer argument for access_ok(),
causing one warning in drivers/scsi/pmcraid.c. I tried changing x86
the same way and found the same warning in __get_user_pages_fast()
and nowhere else in the kernel during randconfig testing:

mm/gup.c: In function '__get_user_pages_fast':
mm/gup.c:1578:6: error: passing argument 1 of '__chk_range_not_ok' makes pointer from integer without a cast [-Werror=int-conversion]

It would probably be a good idea to enforce type-safety in general,
so let's change this file to not cause a warning if we do that.

I don't know why the warning did not appear on MIPS.

Fixes: 2667f50e8b81 ("mm: introduce a general RCU get_user_pages_fast()")
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 mm/gup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/gup.c b/mm/gup.c
index 2559a3987de7..7f5bc26d9229 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1575,7 +1575,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
 	end = start + len;
 
 	if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ,
-					start, len)))
+					(void __user *)start, len)))
 		return 0;
 
 	/*
-- 
2.9.0

[toc] | [next] | [standalone]


#1628948

FromIngo Molnar <mingo@kernel.org>
Date2017-04-23 11:30 +0200
Message-ID<tzm0a-6Gl-7@gated-at.bofh.it>
In reply to#1628377
* Arnd Bergmann <arnd@arndb.de> wrote:

> MIPS just got changed to only accept a pointer argument for access_ok(),
> causing one warning in drivers/scsi/pmcraid.c. I tried changing x86
> the same way and found the same warning in __get_user_pages_fast()
> and nowhere else in the kernel during randconfig testing:

Doing that for x86 access_ok() would definitely be a good idea.

> mm/gup.c: In function '__get_user_pages_fast':
> mm/gup.c:1578:6: error: passing argument 1 of '__chk_range_not_ok' makes pointer from integer without a cast [-Werror=int-conversion]
> 
> It would probably be a good idea to enforce type-safety in general,
> so let's change this file to not cause a warning if we do that.
> 
> I don't know why the warning did not appear on MIPS.
> 
> Fixes: 2667f50e8b81 ("mm: introduce a general RCU get_user_pages_fast()")
> Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  mm/gup.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/gup.c b/mm/gup.c
> index 2559a3987de7..7f5bc26d9229 100644
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -1575,7 +1575,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
>  	end = start + len;
>  
>  	if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ,
> -					start, len)))
> +					(void __user *)start, len)))
>  		return 0;

Acked-by: Ingo Molnar <mingo@kernel.org>

Thanks,

	Ingo

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web