summary refs log tree commit diff stats
path: root/hw/misc/iotkit-secctl.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2022-07-26 19:23:40 +0100
committerDaniel Henrique Barboza <danielhb413@gmail.com>2022-07-28 10:31:54 -0300
commiteda3f17bcd7b96cf43b1aead3c1c93a2dbbd21ae (patch)
tree6af51efa0f86387d568cab022aca7040516b33f2 /hw/misc/iotkit-secctl.c
parentedccf661e6205d5ffff73860ab22eaf08a611ad9 (diff)
downloadfocaccia-qemu-eda3f17bcd7b96cf43b1aead3c1c93a2dbbd21ae.tar.gz
focaccia-qemu-eda3f17bcd7b96cf43b1aead3c1c93a2dbbd21ae.zip
hw/ppc/ppc440_uc: Initialize length passed to cpu_physical_memory_map()
In dcr_write_dma(), there is code that uses cpu_physical_memory_map()
to implement a DMA transfer.  That function takes a 'plen' argument,
which points to a hwaddr which is used for both input and output: the
caller must set it to the size of the range it wants to map, and on
return it is updated to the actual length mapped. The dcr_write_dma()
code fails to initialize rlen and wlen, so will end up mapping an
unpredictable amount of memory.

Initialize the length values correctly, and check that we managed to
map the entire range before using the fast-path memmove().

This was spotted by Coverity, which points out that we never
initialized the variables before using them.

Fixes: Coverity CID 1487137, 1487150
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220726182341.1888115-2-peter.maydell@linaro.org>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Diffstat (limited to 'hw/misc/iotkit-secctl.c')
0 files changed, 0 insertions, 0 deletions