* [PATCH v2 13/40] sh/uaccess: fix sparse errors
[not found] <1420558883-10131-1-git-send-email-mst@redhat.com>
@ 2015-01-06 15:44 ` Michael S. Tsirkin
2015-01-06 15:44 ` [PATCH v2 21/40] sh: fix put_user " Michael S. Tsirkin
2015-01-06 15:45 ` [PATCH v2 39/40] sh: macro whitespace fixes Michael S. Tsirkin
2 siblings, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2015-01-06 15:44 UTC (permalink / raw)
To: linux-kernel; +Cc: Arnd Bergmann, linux-arch, linux-sh
virtio wants to read bitwise types from userspace using get_user. At the
moment this triggers sparse errors, since the value is passed through an
integer.
Fix that up using __force.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
arch/sh/include/asm/uaccess.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h
index 9486376..a49635c 100644
--- a/arch/sh/include/asm/uaccess.h
+++ b/arch/sh/include/asm/uaccess.h
@@ -60,7 +60,7 @@ struct __large_struct { unsigned long buf[100]; };
const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
__chk_user_ptr(ptr); \
__get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
- (x) = (__typeof__(*(ptr)))__gu_val; \
+ (x) = (__force __typeof__(*(ptr)))__gu_val; \
__gu_err; \
})
@@ -71,7 +71,7 @@ struct __large_struct { unsigned long buf[100]; };
const __typeof__(*(ptr)) *__gu_addr = (ptr); \
if (likely(access_ok(VERIFY_READ, __gu_addr, (size)))) \
__get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
- (x) = (__typeof__(*(ptr)))__gu_val; \
+ (x) = (__force __typeof__(*(ptr)))__gu_val; \
__gu_err; \
})
--
MST
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 21/40] sh: fix put_user sparse errors
[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
2015-01-06 15:45 ` [PATCH v2 39/40] sh: macro whitespace fixes Michael S. Tsirkin
2 siblings, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2015-01-06 15:44 UTC (permalink / raw)
To: linux-kernel; +Cc: Arnd Bergmann, linux-arch, linux-sh
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 39/40] sh: macro whitespace fixes
[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 ` [PATCH v2 21/40] sh: fix put_user " Michael S. Tsirkin
@ 2015-01-06 15:45 ` Michael S. Tsirkin
2 siblings, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2015-01-06 15:45 UTC (permalink / raw)
To: linux-kernel; +Cc: Arnd Bergmann, linux-arch, linux-sh
While working on arch/sh/include/asm/uaccess.h, I noticed
that one macro within this header is made harder to read because it
violates a coding style rule: space is missing after comma.
Fix it up.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
arch/sh/include/asm/segment.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/sh/include/asm/segment.h b/arch/sh/include/asm/segment.h
index 5e2725f..ff795d3 100644
--- a/arch/sh/include/asm/segment.h
+++ b/arch/sh/include/asm/segment.h
@@ -23,7 +23,7 @@ typedef struct {
#define USER_DS KERNEL_DS
#endif
-#define segment_eq(a,b) ((a).seg = (b).seg)
+#define segment_eq(a, b) ((a).seg = (b).seg)
#define get_ds() (KERNEL_DS)
--
MST
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-06 15:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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 ` [PATCH v2 21/40] sh: fix put_user " Michael S. Tsirkin
2015-01-06 15:45 ` [PATCH v2 39/40] sh: macro whitespace fixes Michael S. Tsirkin
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).