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 <m...@redhat.com>
---
 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to