]> git.ipfire.org Git - thirdparty/qemu.git/commit
target/ppc: use MAKE_64BIT_MASK for mcrfs exception clear mask
authorDenis Sergeev <zeff@altlinux.org>
Mon, 15 Sep 2025 08:01:18 +0000 (11:01 +0300)
committerHarsh Prateek Bora <harshpb@linux.ibm.com>
Sun, 28 Sep 2025 18:20:36 +0000 (23:50 +0530)
commit6c51df580d2a64b4e1ef7bdbffeb3615ffe25d43
tree44011d0a8871f89d99beab6a50d76fc10fff9395
parent264a604e71636bd04bfbbe3cf887259f246dccb3
target/ppc: use MAKE_64BIT_MASK for mcrfs exception clear mask

In gen_mcrfs() the FPSCR nibble mask is computed as:
      `~((0xF << shift) & FP_EX_CLEAR_BITS)`

Here, 0xF is of type int, so the left shift is performed in
32-bit signed arithmetic. For bfa=0 we get shift=28,
and (0xF << 28) = 0xF0000000, which is not representable as a 32-bit
signed int. Static analyzers flag this as a potential integer
overflow.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Denis Sergeev <zeff@altlinux.org>
Reviewed-by: Chinmay Rath <rathc@linux.ibm.com>
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Link: https://lore.kernel.org/r/20250915080118.29898-1-zeff@altlinux.org
Message-ID: <20250915080118.29898-1-zeff@altlinux.org>
target/ppc/translate/fp-impl.c.inc