From: Greg Ungerer <gerg@linux-m68k.org>
To: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>,
Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org,
kbuild test robot <lkp@intel.com>
Subject: Re: [PATCH 2/2] m68k,nommu: fix implicit cast from __user in __{get,put}_user_asm()
Date: Fri, 29 May 2020 23:21:38 +1000 [thread overview]
Message-ID: <8e2f9ac6-b277-0b80-c150-eb372fbeaf0a@linux-m68k.org> (raw)
In-Reply-To: <20200528202514.27175-3-luc.vanoostenryck@gmail.com>
Hi Luc,
On 29/5/20 6:25 am, Luc Van Oostenryck wrote:
> The assembly for __get_user_asm() & __put_user_asm() uses memcpy()
> when the size is 8.
>
> However, the pointer is always a __user one while memcpy() expect
> a plan one and so this cast creates a lot of warnings when using ^^^^
Did you mean "plain"?
> Sparse.
>
> So, fix this by adding a cast to 'void __force *' at memcpy()'s
> argument.
>
> Reported-by: kbuild test robot <lkp@intel.com>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> ---
> arch/m68k/include/asm/uaccess_no.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/m68k/include/asm/uaccess_no.h b/arch/m68k/include/asm/uaccess_no.h
> index 9651766a62af..f32f08a64eaa 100644
> --- a/arch/m68k/include/asm/uaccess_no.h
> +++ b/arch/m68k/include/asm/uaccess_no.h
> @@ -42,7 +42,7 @@ static inline int _access_ok(unsigned long addr, unsigned long size)
> __put_user_asm(__pu_err, __pu_val, ptr, l); \
> break; \
> case 8: \
> - memcpy(ptr, &__pu_val, sizeof (*(ptr))); \
> + memcpy((void __force*)ptr, &__pu_val, sizeof (*(ptr))); \
^^^
checkpatch wants a ' ' space in there.
Otherwise I think it looks good.
Regards
Greg
> break; \
> default: \
> __pu_err = __put_user_bad(); \
> @@ -85,7 +85,7 @@ extern int __put_user_bad(void);
> u64 l; \
> __typeof__(*(ptr)) t; \
> } __gu_val; \
> - memcpy(&__gu_val.l, ptr, sizeof(__gu_val.l)); \
> + memcpy(&__gu_val.l, (const void __force*)ptr, sizeof(__gu_val.l)); \
> (x) = __gu_val.t; \
> break; \
> } \
>
prev parent reply other threads:[~2020-05-29 13:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-28 20:25 [PATCH 0/2] fix missing handling of __user in nommu's uaccess() Luc Van Oostenryck
2020-05-28 20:25 ` [PATCH 1/2] m68k,nommu: add missing __user in uaccess' __ptr() macro Luc Van Oostenryck
2020-05-28 20:25 ` [PATCH 2/2] m68k,nommu: fix implicit cast from __user in __{get,put}_user_asm() Luc Van Oostenryck
2020-05-29 13:21 ` Greg Ungerer [this message]
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=8e2f9ac6-b277-0b80-c150-eb372fbeaf0a@linux-m68k.org \
--to=gerg@linux-m68k.org \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=lkp@intel.com \
--cc=luc.vanoostenryck@gmail.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®