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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux