qemu-cr16/hw
Peter Maydell 3ffa21d293 hw/s390x/s390-pci-bus.c: Use g_assert_not_reached() in functions taking an ett
The s390-pci-bus.c code, Coverity complains about a possible overflow
because get_table_index() can return -1 if the ett value passed in is
not one of the three permitted ZPCI_ETT_PT, ZPCI_ETT_ST, ZPCI_ETT_RT,
but the caller in table_translate() doesn't check this and instead
uses the return value directly in a calculation of the guest address
to read from.

In fact this case cannot happen, because:
 * get_table_index() is called only from table_translate()
 * the only caller of table_translate() loops through the ett values
   in the order RT, ST, PT until table_translate() returns 0
 * table_translate() will return 0 for the error cases and when
   translate_iscomplete() returns true
 * translate_iscomplete() is always true for ZPCI_ETT_PT

So table_translate() is always called with a valid ett value.

Instead of having the various functions called from table_translate()
return a default or dummy value when the ett argument is out of range,
use g_assert_not_reached() to indicate that this is impossible.

Coverity: CID 1547609
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Message-ID: <20250710161552.1287399-1-peter.maydell@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2025-07-11 09:42:47 +02:00
..
9pfs 9pfs: fix 'total_open_fd' decrementation 2025-05-05 11:28:29 +02:00
acpi treewide: update docs file extensions (.txt -> .rst) in comments 2025-07-02 18:26:27 +02:00
adc qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
alpha qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
arm target-arm queue: 2025-07-07 09:22:41 -04:00
audio hw/audio/via-ac97: skip automatic zero-init of large array 2025-06-12 13:40:15 -04:00
avr qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
block hw/block: Drop unused nand.c 2025-05-29 17:45:13 +01:00
char hw/char: sifive_uart: Avoid infinite delay of async xmit function 2025-07-04 21:09:48 +10:00
core hw/core/qdev-properties-system: Add missing return in set_drive_helper() 2025-06-04 18:16:34 +02:00
cpu qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
cxl hw/cxl/cxl-mailbox-utils: CXL CCI Get/Set alert config commands 2025-05-14 05:39:14 -04:00
display virtio-gpu: support context init multiple timeline 2025-07-02 10:10:07 +01:00
dma hw/dma/xlnx_csu_dma: skip automatic zero-init of large array 2025-06-12 13:40:15 -04:00
fsi qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
gpio hw/gpio/pca9552: Avoid using g_newa() 2025-06-10 12:59:09 +02:00
hppa qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
hyperv hw/hyperv/syndbg: skip automatic zero-init of large array 2025-06-12 13:40:15 -04:00
i2c hw/arm: Replace TABs for spaces in OMAP board and device code 2025-05-14 14:29:47 +01:00
i386 i386/tdx: Build TDX only for 64-bit target 2025-07-03 13:42:28 +02:00
ide qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
input vhost-user: return failure if backend crash when live migration 2025-05-14 05:39:15 -04:00
intc migration: Fix migration failure when aia is configured as aplic-imsic 2025-07-04 21:09:49 +10:00
ipack qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
ipmi qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
isa hw/isa/ich9: Remove stray empty comment 2025-05-09 23:49:26 +03:00
loongarch hw/loongarch/virt: Add kernel irqchip support 2025-06-19 15:55:21 +08:00
m68k qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
mem hw/cxl/cxl-mailbox-utils: CXL CCI Get/Set alert config commands 2025-05-14 05:39:14 -04:00
microblaze hw/microblaze: Remove the big-endian variants of ml605 and xlnx-zynqmp-pmu 2025-05-30 09:52:08 +02:00
mips hw/mips: Evaluate TARGET_BIG_ENDIAN at compile time 2025-04-25 17:09:58 +02:00
misc hw/misc/aspeed_scu: Handle AST2600 protection key registers correctly 2025-07-03 13:41:57 +02:00
net hw: replace FSF postal address with licenses URL 2025-06-26 00:42:37 +02:00
nubus qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
nvme treewide: fix paths for relocated files in comments 2025-07-02 18:26:27 +02:00
nvram hw/nvram/fw_cfg: Remove legacy FW_CFG_ORDER_OVERRIDE 2025-05-30 09:52:08 +02:00
openrisc qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
pci pci: skip reset during cpr 2025-06-11 14:01:58 +02:00
pci-bridge qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
pci-host hw/ppc/e500: Use SysBusDevice API to access TYPE_CCSR's internal resources 2025-06-10 12:59:09 +02:00
ppc treewide: update docs file extensions (.txt -> .rst) in comments 2025-07-02 18:26:27 +02:00
remote qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
riscv target: riscv: Add Svrsw60t59b extension support 2025-07-04 21:09:49 +10:00
rtc hw/rtc/mc146818rtc: Drop pre-v3 migration stream support 2025-04-30 20:44:20 +02:00
rx qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
s390x hw/s390x/s390-pci-bus.c: Use g_assert_not_reached() in functions taking an ett 2025-07-11 09:42:47 +02:00
scsi hw: replace FSF postal address with licenses URL 2025-06-26 00:42:37 +02:00
sd qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
sensor qom: Constify TypeInfo::class_data 2025-04-25 17:00:41 +02:00
sh4 include: Remove 'exec/exec-all.h' 2025-04-30 12:45:05 -07:00
smbios ipmi: add fwinfo to pci ipmi devices 2025-04-11 10:50:42 -05:00
sparc qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
sparc64 qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
ssi hw/ssi/aspeed_smc: Allow 64-bit wide flash accesses 2025-05-05 09:38:55 +02:00
timer hpet: return errors from realize if properties are incorrect 2025-06-06 14:32:54 +02:00
tpm qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
tricore qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
uefi qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
ufs hw/ufs/lu: skip automatic zero-init of large array 2025-06-12 13:40:16 -04:00
usb hw/usb/hcd-ohci: skip automatic zero-init of large array 2025-06-12 13:40:16 -04:00
vfio vfio/container: delete old cpr register 2025-07-03 13:42:28 +02:00
vfio-user vfio-user: do not register vfio-user container with cpr 2025-07-03 13:42:28 +02:00
virtio memory: Unify the definiton of ReplayRamPopulate() and ReplayRamDiscard() 2025-06-23 16:03:59 -04:00
vmapple qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
watchdog qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
xen trivial patches for 2025-05-09 2025-05-12 11:11:27 -04:00
xenpv hw/boards: Do not create unusable default if=sd drives 2025-02-16 14:25:08 +01:00
xtensa qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
Kconfig vfio-user: add vfio-user class and container 2025-06-26 08:55:38 +02:00
meson.build vfio-user: add vfio-user class and container 2025-06-26 08:55:38 +02:00