riscv: uaccess: fix sparse warning about cast to restricted type
PATCH 1/1 riscv: uaccess: fix sparse warning about cast to restricted type
It seems recent changes have made sparse warning about casting to restricted types whe using __get_user() in drivers such as the drivers/pci/proc.c.
Fix this with a __force to fix such warnings as:
drivers/pci/proc.c:148:17: warning: cast to restricted __le16 drivers/pci/proc.c:148:17: warning: cast to restricted __le16 drivers/pci/proc.c:148:17: warning: cast to restricted __le16 drivers/pci/proc.c:148:17: warning: cast to restricted __le16 drivers/pci/proc.c:157:17: warning: cast to restricted __le32 drivers/pci/proc.c:157:17: warning: cast to restricted __le32 drivers/pci/proc.c:157:17: warning: cast to restricted __le32 drivers/pci/proc.c:157:17: warning: cast to restricted __le32 drivers/pci/proc.c:166:17: warning: cast to restricted __le16 drivers/pci/proc.c:166:17: warning: cast to restricted __le16 drivers/pci/proc.c:166:17: warning: cast to restricted __le16 drivers/pci/proc.c:166:17: warning: cast to restricted __le16
--- arch/riscv/include/asm/uaccess.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/include/asm/uaccess.h +1 -1
@@ -112,7 +112,7 @@ do { \ _ASM_EXTABLE_UACCESS_ERR(1b, %l2, %0) \ : "=&r" (__tmp) \ : "m" (*(ptr)) : : label); \ - (x) = (__typeof__(x))(unsigned long)__tmp; \ + (x) = (__force __typeof__(x))(unsigned long)__tmp; \ } while (0) #else /* !CONFIG_CC_HAS_ASM_GOTO_OUTPUT */ #define __get_user_asm(insn, x, ptr, label) \
Signature · 1 line
2.37.2.352.g3c44437643