summary refs log tree commit diff stats
path: root/scripts/signrom.py
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2016-08-08 10:06:25 +1000
committerDavid Gibson <david@gibson.dropbear.id.au>2016-08-08 10:06:25 +1000
commit57c0eb1e0d6d8f01550d10cf08747f25cd537777 (patch)
treedca68aefc864954a3429af532d126d9d8430a9f2 /scripts/signrom.py
parent16275edb342342625cd7e7ac2048436474465b50 (diff)
downloadfocaccia-qemu-57c0eb1e0d6d8f01550d10cf08747f25cd537777.tar.gz
focaccia-qemu-57c0eb1e0d6d8f01550d10cf08747f25cd537777.zip
spapr: Fix undefined behaviour in spapr_tce_reset()
When a TCE table (sPAPR IOMMU context) is in disabled state (which is true
by default for the 64-bit window), it has tcet->nb_table == 0 and
tcet->table == NULL.  However, on system reset, spapr_tce_reset() executes,
which unconditionally calls
        memset(tcet->table, 0, table_size);

We get away with this in practice, because it's a zero length memset(),
but memset() on a NULL pointer is undefined behaviour, so we should not
call it in this case.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'scripts/signrom.py')
0 files changed, 0 insertions, 0 deletions