Linux-m68k Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] m68k: add missing __user annotation in get_user()
@ 2020-05-20  6:57 Jason Wang
  2020-05-20  8:55 ` Michael S. Tsirkin
  2020-05-25  8:47 ` Geert Uytterhoeven
  0 siblings, 2 replies; 3+ messages in thread
From: Jason Wang @ 2020-05-20  6:57 UTC (permalink / raw)
  To: geert; +Cc: linux-m68k, linux-kernel, mst, Jason Wang, kbuild test robot

The ptr is a pointer to userspace memory. So we need annotate it with
__user otherwise we may get sparse warnings like:

drivers/vhost/vhost.c:1603:13: sparse: sparse: incorrect type in initializer (different address spaces) @@    expected void const *__gu_ptr @@    got unsigned int [noderef] [usertypvoid const *__gu_ptr @@
drivers/vhost/vhost.c:1603:13: sparse:    expected void const *__gu_ptr
drivers/vhost/vhost.c:1603:13: sparse:    got unsigned int [noderef] [usertype] <asn:1> *idxp

Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Cc: linux-kernel@vger.kernel.org
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 arch/m68k/include/asm/uaccess_mm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/m68k/include/asm/uaccess_mm.h b/arch/m68k/include/asm/uaccess_mm.h
index 7e85de984df1..9ae9f8d05925 100644
--- a/arch/m68k/include/asm/uaccess_mm.h
+++ b/arch/m68k/include/asm/uaccess_mm.h
@@ -142,7 +142,7 @@ asm volatile ("\n"					\
 		__get_user_asm(__gu_err, x, ptr, u32, l, r, -EFAULT);	\
 		break;							\
 	case 8: {							\
-		const void *__gu_ptr = (ptr);				\
+		const void __user *__gu_ptr = (ptr);			\
 		union {							\
 			u64 l;						\
 			__typeof__(*(ptr)) t;				\
-- 
2.20.1


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

* Re: [PATCH] m68k: add missing __user annotation in get_user()
  2020-05-20  6:57 [PATCH] m68k: add missing __user annotation in get_user() Jason Wang
@ 2020-05-20  8:55 ` Michael S. Tsirkin
  2020-05-25  8:47 ` Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2020-05-20  8:55 UTC (permalink / raw)
  To: Jason Wang; +Cc: geert, linux-m68k, linux-kernel, kbuild test robot

On Wed, May 20, 2020 at 02:57:50PM +0800, Jason Wang wrote:
> The ptr is a pointer to userspace memory. So we need annotate it with
> __user otherwise we may get sparse warnings like:
> 
> drivers/vhost/vhost.c:1603:13: sparse: sparse: incorrect type in initializer (different address spaces) @@    expected void const *__gu_ptr @@    got unsigned int [noderef] [usertypvoid const *__gu_ptr @@
> drivers/vhost/vhost.c:1603:13: sparse:    expected void const *__gu_ptr
> drivers/vhost/vhost.c:1603:13: sparse:    got unsigned int [noderef] [usertype] <asn:1> *idxp
> 
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: linux-m68k@lists.linux-m68k.org
> Cc: linux-kernel@vger.kernel.org
> Reported-by: kbuild test robot <lkp@intel.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>

Makes sense:

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  arch/m68k/include/asm/uaccess_mm.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/m68k/include/asm/uaccess_mm.h b/arch/m68k/include/asm/uaccess_mm.h
> index 7e85de984df1..9ae9f8d05925 100644
> --- a/arch/m68k/include/asm/uaccess_mm.h
> +++ b/arch/m68k/include/asm/uaccess_mm.h
> @@ -142,7 +142,7 @@ asm volatile ("\n"					\
>  		__get_user_asm(__gu_err, x, ptr, u32, l, r, -EFAULT);	\
>  		break;							\
>  	case 8: {							\
> -		const void *__gu_ptr = (ptr);				\
> +		const void __user *__gu_ptr = (ptr);			\
>  		union {							\
>  			u64 l;						\
>  			__typeof__(*(ptr)) t;				\
> -- 
> 2.20.1


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

* Re: [PATCH] m68k: add missing __user annotation in get_user()
  2020-05-20  6:57 [PATCH] m68k: add missing __user annotation in get_user() Jason Wang
  2020-05-20  8:55 ` Michael S. Tsirkin
@ 2020-05-25  8:47 ` Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2020-05-25  8:47 UTC (permalink / raw)
  To: Jason Wang
  Cc: linux-m68k, Linux Kernel Mailing List, Michael S. Tsirkin,
	kbuild test robot

On Wed, May 20, 2020 at 8:58 AM Jason Wang <jasowang@redhat.com> wrote:
> The ptr is a pointer to userspace memory. So we need annotate it with
> __user otherwise we may get sparse warnings like:
>
> drivers/vhost/vhost.c:1603:13: sparse: sparse: incorrect type in initializer (different address spaces) @@    expected void const *__gu_ptr @@    got unsigned int [noderef] [usertypvoid const *__gu_ptr @@
> drivers/vhost/vhost.c:1603:13: sparse:    expected void const *__gu_ptr
> drivers/vhost/vhost.c:1603:13: sparse:    got unsigned int [noderef] [usertype] <asn:1> *idxp
>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: linux-m68k@lists.linux-m68k.org
> Cc: linux-kernel@vger.kernel.org
> Reported-by: kbuild test robot <lkp@intel.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>

Fixes: 7124330dabe5b3cb ("m68k/uaccess: Revive 64-bit get_user()")

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
i.e. will queue in the m68k for-v5.8 branch.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20  6:57 [PATCH] m68k: add missing __user annotation in get_user() Jason Wang
2020-05-20  8:55 ` Michael S. Tsirkin
2020-05-25  8:47 ` Geert Uytterhoeven

Linux-m68k Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-m68k/0 linux-m68k/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-m68k linux-m68k/ https://lore.kernel.org/linux-m68k \
		linux-m68k@vger.kernel.org linux-m68k@lists.linux-m68k.org
	public-inbox-index linux-m68k

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-m68k


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git