mirror of https://github.com/xemu-project/xemu.git
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> |
||
|---|---|---|
| .. | ||
| dataplane | ||
| Kconfig | ||
| block.c | ||
| cdrom.c | ||
| ecc.c | ||
| fdc-internal.h | ||
| fdc-isa.c | ||
| fdc-sysbus.c | ||
| fdc.c | ||
| hd-geometry.c | ||
| m25p80.c | ||
| m25p80_sfdp.c | ||
| m25p80_sfdp.h | ||
| meson.build | ||
| nand.c | ||
| onenand.c | ||
| pflash_cfi01.c | ||
| pflash_cfi02.c | ||
| swim.c | ||
| tc58128.c | ||
| trace-events | ||
| trace.h | ||
| vhost-user-blk.c | ||
| virtio-blk-common.c | ||
| virtio-blk.c | ||
| xen-block.c | ||
| xen_blkif.h | ||