qemu/system
Vladimir Sementsov-Ogievskiy adff55b520 coverity: physmem: use simple assertions instead of modelling
Unfortunately Coverity doesn't follow the logic aroung "len" and "l"
variables in stacks finishing with flatview_{read,write}_continue() and
generate a lot of OVERRUN false-positives. When small buffer (2 or 4
bytes) is passed to mem read/write path, Coverity assumes the worst
case of sz=8 in stn_he_p()/ldn_he_p() (defined in
include/qemu/bswap.h), and reports buffer overrun.

To silence these false-positives we have model functions, which hide
real logic from Coverity.

However, it turned out that these new two assertions are enough to
quiet Coverity.

Assertions are better than hiding the logic, so let's drop the
modelling and move to assertions for memory r/w call stacks.

After patch, the sequence

 cov-make-library --output-file /tmp/master.xmldb \
    scripts/coverity-scan/model.c
 cov-build --dir ~/covtmp/master make -j9
 cov-analyze --user-model-file /tmp/master.xmldb \
    --dir ~/covtmp/master --all --strip-path "$(pwd)
 cov-format-errors --dir ~/covtmp/master \
    --html-output ~/covtmp/master_html_report

Generate for me the same big set of CIDs excepept for 6 disappeared (so
it becomes even better).

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Acked-by: David Hildenbrand <david@redhat.com>
Message-ID: <20231005140326.332830-1-vsementsov@yandex-team.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-11-24 12:07:47 +01:00
..
arch_init.c system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
async-teardown.c system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
balloon.c balloon: Fix a misleading error message 2023-11-17 10:07:52 +01:00
bootdevice.c system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
cpu-throttle.c system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
cpu-timers.c system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
cpus.c system/cpus: Fix CPUState.nr_cores' calculation 2023-11-07 13:08:48 +01:00
datadir.c system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
device_tree.c system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
dirtylimit.c system/dirtylimit: Drop the reduplicative check 2023-11-03 07:48:25 +01:00
dma-helpers.c system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
globals.c system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
ioport.c system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
main.c softmmu: pass the main loop status to gdb "Wxx" packet 2023-10-12 12:33:24 +10:00
memory.c memory: Introduce memory_region_iommu_set_iova_ranges 2023-11-03 09:20:31 +01:00
memory_mapping.c memory: follow Error API guidelines 2023-10-19 23:13:27 +02:00
meson.build system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
physmem.c coverity: physmem: use simple assertions instead of modelling 2023-11-24 12:07:47 +01:00
qdev-monitor.c Add virtio-sound-pci device 2023-11-07 03:39:10 -05:00
qemu-seccomp.c system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
qtest.c system/qtest: Clean up global variable shadowing in qtest_server_init() 2023-10-27 09:39:08 +02:00
rtc.c system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
runstate-action.c system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
runstate-hmp-cmds.c system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
runstate.c softmmu: pass the main loop status to gdb "Wxx" packet 2023-10-12 12:33:24 +10:00
tpm-hmp-cmds.c system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
tpm.c * util/log: re-allow switching away from stderr log file 2023-10-09 10:11:18 -04:00
trace-events system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
trace.h system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
vl.c Xen fixes for 8.2-rc1 2023-11-21 10:27:10 -05:00
watchpoint.c accel/tcg: Remove CF_LAST_IO 2023-11-14 10:40:54 -08:00