[PATCH v2 23/40] tile: enable sparse checks for get/put_user

From: Michael S. Tsirkin
Date: Tue Jan 06 2015 - 10:45:06 EST


Tile currently does not trigger sparse warnings when get_user
causes an illegal assignment across bitwise types.

For example:

__le32 __user *p;
__u32 x;
put_user(x, p);

violates endian-ness rules, but currently does not trigger sparse
warning on tile.

Fix this by adding some dead code.

Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
---
arch/tile/include/asm/uaccess.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/arch/tile/include/asm/uaccess.h b/arch/tile/include/asm/uaccess.h
index 22cffa1..03d905c 100644
--- a/arch/tile/include/asm/uaccess.h
+++ b/arch/tile/include/asm/uaccess.h
@@ -218,6 +218,8 @@ extern int __get_user_bad(void)
case 8: __get_user_8(x, ptr, __ret); break; \
default: __ret = __get_user_bad(); break; \
} \
+ if (0) \
+ x = *(__force typeof(*ptr) *)(ptr); \
__ret; \
})

@@ -297,6 +299,8 @@ extern int __put_user_bad(void)
case 8: __put_user_8(x, ptr, __ret); break; \
default: __ret = __put_user_bad(); break; \
} \
+ if (0) \
+ *(__force typeof(*ptr) *)(ptr) = x; \
__ret; \
})

--
MST

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/