summary refs log tree commit diff stats
path: root/scripts/compare-machine-types.py
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2024-07-31 15:36:13 +0100
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2024-08-06 10:22:52 +0200
commit8f64e7449e474e18017eb1414bc13e491edd8596 (patch)
tree492f4c3d66289cfa76a953e74f36a3869e3679ea /scripts/compare-machine-types.py
parented5a159c3de48a581f46de4c8c02b4b295e6c52d (diff)
downloadfocaccia-qemu-8f64e7449e474e18017eb1414bc13e491edd8596.tar.gz
focaccia-qemu-8f64e7449e474e18017eb1414bc13e491edd8596.zip
hw/block/pflash_cfi01: Don't decrement pfl->counter below 0
In pflash_write() Coverity points out that we can decrement the
unsigned pfl->counter below zero, which makes it wrap around.  In
fact this is harmless, because if pfl->counter is 0 at this point we
also increment pfl->wcycle to 3, and the wcycle == 3 handling doesn't
look at counter; the only way back into code which looks at the
counter value is via wcycle == 1, which will reinitialize the counter.
But it's arguably a little clearer to break early in the "counter ==
0" if(), to avoid the decrement-below-zero.

Resolves: Coverity CID 1547611
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20240731143617.3391947-4-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Diffstat (limited to 'scripts/compare-machine-types.py')
0 files changed, 0 insertions, 0 deletions