summary refs log tree commit diff stats
path: root/hw/ide/pci.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2024-07-31 15:36:15 +0100
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2024-08-06 10:22:52 +0200
commit11b46661613f847cd0c4070baa2d33c9ff2f3fcd (patch)
tree2eea4976de0702565076214b28b2e8f63ee143c2 /hw/ide/pci.c
parentf63085c85d164484a58fa320114f389c91194487 (diff)
downloadfocaccia-qemu-11b46661613f847cd0c4070baa2d33c9ff2f3fcd.tar.gz
focaccia-qemu-11b46661613f847cd0c4070baa2d33c9ff2f3fcd.zip
hw/block/fdc-isa: Assert that isa_fdc_get_drive_max_chs() found something
Coverity complains about an overflow in isa_fdc_get_drive_max_chs()
that can happen if the loop over fd_formats never finds a match,
because we initialize *maxc to 0 and then at the end of the
function decrement it.

This can't ever actually happen because fd_formats has at least
one entry for each FloppyDriveType, so we must at least once
find a match and update *maxc, *maxh and *maxs. Assert that we
did find a match, which should keep Coverity happy and will also
detect possible bugs in the data in fd_formats.

Resolves: Coverity CID 1547663
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240731143617.3391947-6-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Diffstat (limited to 'hw/ide/pci.c')
0 files changed, 0 insertions, 0 deletions