All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Michal Hocko <mhocko@suse.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Lorenzo Stoakes <lstoakes@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: gup: fix access_ok() argument type
Date: Sun, 23 Apr 2017 11:20:21 +0200	[thread overview]
Message-ID: <20170423092021.xpfyapinlxmxpi5l@gmail.com> (raw)
In-Reply-To: <20170421162659.3314521-1-arnd@arndb.de>


* 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

WARNING: multiple messages have this Message-ID
From: Ingo Molnar <mingo@kernel.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Michal Hocko <mhocko@suse.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Lorenzo Stoakes <lstoakes@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: gup: fix access_ok() argument type
Date: Sun, 23 Apr 2017 11:20:21 +0200	[thread overview]
Message-ID: <20170423092021.xpfyapinlxmxpi5l@gmail.com> (raw)
In-Reply-To: <20170421162659.3314521-1-arnd@arndb.de>


* 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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-04-23  9:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-21 16:26 Arnd Bergmann
2017-04-21 16:26 ` Arnd Bergmann
2017-04-23  9:20 ` Ingo Molnar [this message]
2017-04-23  9:20   ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170423092021.xpfyapinlxmxpi5l@gmail.com \
    --to=mingo@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lstoakes@gmail.com \
    --cc=mhocko@suse.com \
    --cc=viro@zeniv.linux.org.uk \
    --subject='Re: [PATCH] mm: gup: fix access_ok() argument type' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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.