diff options
| author | Sean Chang <seanwascoding@gmail.com> | 2026-06-08 23:52:52 +0800 |
|---|---|---|
| committer | Anup Patel <anup@brainfault.org> | 2026-06-14 11:09:41 +0530 |
| commit | 52738352a6f29279e15285fcb7b50241ef867e27 (patch) | |
| tree | f453566bb45fa9f15fc56cf993dbb885c937926f /include/linux/ptp_clock_kernel.h | |
| parent | a5f8307e2eaaf5d3acae6554d84fcd2683613cc4 (diff) | |
| download | lwn-52738352a6f29279e15285fcb7b50241ef867e27.tar.gz lwn-52738352a6f29279e15285fcb7b50241ef867e27.zip | |
riscv: kvm: Use endian-specific __lelong for NACL shared memory
When compiling with sparse enabled (C=2), bitwise type warnings are
triggered in the RISC-V KVM implementation. This occurs because the
user-space data unboxing macro '__get_user_asm' performs implicit
casting on restricted types without forcing the compiler's compliance.
Additionally, raw 'unsigned long *' pointers are used to access the
SBI NACL shared memory, whereas the RISC-V SBI specification mandates
that these structures must follow little-endian byte ordering.
Fix these by:
1. Adding a '__force' cast to '__get_user_asm()' to safely suppress
implicit cast warnings during user-space data fetching.
2. Introducing the '__lelong' type macro, which dynamically resolves to
'__le32' or '__le64' depending on XLEN, and replacing 'unsigned long *'
with '__lelong *' to enforce proper compile-time endianness checks.
Signed-off-by: Sean Chang <seanwascoding@gmail.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20260608155252.4292-1-seanwascoding@gmail.com
Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'include/linux/ptp_clock_kernel.h')
0 files changed, 0 insertions, 0 deletions
