From: "Michael S. Tsirkin" <mst@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>,
linux-arch@vger.kernel.org, linux-sh@vger.kernel.org
Subject: [PATCH v2 21/40] sh: fix put_user sparse errors
Date: Tue, 06 Jan 2015 15:44:41 +0000 [thread overview]
Message-ID: <1420558883-10131-22-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1420558883-10131-1-git-send-email-mst@redhat.com>
virtio wants to write bitwise types to userspace using put_user.
At the moment this triggers sparse errors, since the value is passed
through an integer.
For example:
__le32 __user *p;
__le32 x;
put_user(x, p);
is safe, but currently triggers a sparse warning.
Fix that up using __force.
Note: this does not suppress any useful sparse checks since caller
assigns x to typeof(*p), which in turn forces all the necessary type
checks.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
arch/sh/include/asm/uaccess_64.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/sh/include/asm/uaccess_64.h b/arch/sh/include/asm/uaccess_64.h
index 2e07e0f..c01376c 100644
--- a/arch/sh/include/asm/uaccess_64.h
+++ b/arch/sh/include/asm/uaccess_64.h
@@ -59,19 +59,19 @@ do { \
switch (size) { \
case 1: \
retval = __put_user_asm_b((void *)&x, \
- (long)ptr); \
+ (__force long)ptr); \
break; \
case 2: \
retval = __put_user_asm_w((void *)&x, \
- (long)ptr); \
+ (__force long)ptr); \
break; \
case 4: \
retval = __put_user_asm_l((void *)&x, \
- (long)ptr); \
+ (__force long)ptr); \
break; \
case 8: \
retval = __put_user_asm_q((void *)&x, \
- (long)ptr); \
+ (__force long)ptr); \
break; \
default: \
__put_user_unknown(); \
--
MST
next prev parent reply other threads:[~2015-01-06 15:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1420558883-10131-1-git-send-email-mst@redhat.com>
2015-01-06 15:44 ` [PATCH v2 13/40] sh/uaccess: fix sparse errors Michael S. Tsirkin
2015-01-06 15:44 ` Michael S. Tsirkin [this message]
2015-01-06 15:45 ` [PATCH v2 39/40] sh: macro whitespace fixes Michael S. Tsirkin
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=1420558883-10131-22-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=arnd@arndb.de \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).