diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2021-02-19 22:32:40 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2021-03-10 13:54:51 +0000 |
commit | 81b3ddaf8772ec6f88d372e52f9b433cfa46bc46 (patch) | |
tree | 9db424c53fd5e7f9cc5e97059be55aa65fd9d9ef /tests/qemu-iotests/214.out | |
parent | 02f8fe11f7af92bacc6fc7f661ea5076e8a63e43 (diff) |
hw/timer/renesas_tmr: Fix use of uninitialized data in read_tcnt()
The read_tcnt() function calculates the TCNT register values for the
two channels of the timer module; it sets these up in the local
tcnt[] array, and eventually returns either one or both of them,
depending on whether the access is 8 or 16 bits. However, not all of
the code paths through this function set both elements of this array:
if the guest has programmed the TCCR.CSS register fields to values
which are either documented as not to be used or which QEMU does not
implement, then the function will return uninitialized data. (This
was spotted by Coverity.)
Add the missing CSS cases to this code, so that we return a
consistent value instead of uninitialized data, and so the code
structure indicates what's happening.
Fixes: CID 1429976
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20210219223241.16344-3-peter.maydell@linaro.org
Diffstat (limited to 'tests/qemu-iotests/214.out')
0 files changed, 0 insertions, 0 deletions