Re: [PATCH v2] hw/arm_sysctl: fix extracting 31th bit of val

2025-01-10 Thread Peter Maydell
On Fri, 20 Dec 2024 at 12:54, Anastasia Belova wrote: > > 1 << 31 is casted to uint64_t while bitwise and with val. > So this value may become 0x8000 but only > 31th "start" bit is required. This can't happen, because the MemoryRegionOps uses the default max access size of 4 bytes, an

[PATCH v2] hw/arm_sysctl: fix extracting 31th bit of val

2024-12-20 Thread Anastasia Belova
1 << 31 is casted to uint64_t while bitwise and with val. So this value may become 0x8000 but only 31th "start" bit is required. Use the bitfield extract() API instead. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Anastasia Belova --- v2: make ext