summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell2021-02-19 23:32:40 +0100
committerPeter Maydell2021-03-10 14:54:51 +0100
commit81b3ddaf8772ec6f88d372e52f9b433cfa46bc46 (patch)
tree9db424c53fd5e7f9cc5e97059be55aa65fd9d9ef /tests
parenthw/timer/renesas_tmr: Prefix constants for CSS values with CSS_ (diff)
downloadqemu-81b3ddaf8772ec6f88d372e52f9b433cfa46bc46.tar.gz
qemu-81b3ddaf8772ec6f88d372e52f9b433cfa46bc46.tar.xz
qemu-81b3ddaf8772ec6f88d372e52f9b433cfa46bc46.zip
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')
0 files changed, 0 insertions, 0 deletions