diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2020-03-24 21:21:03 +0000 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2020-03-31 21:14:35 +0800 |
commit | b88fb1247b8f82ff49a82e69965adca6d329a3b3 (patch) | |
tree | ec3500caaefd6f7f3a01917636e42a1b666e7579 /tests | |
parent | 8ffb7265af64ec81748335ec8f20e7ab542c3850 (diff) |
hw/net/allwinner-sun8i-emac.c: Fix REG_ADDR_HIGH/LOW reads
Coverity points out (CID 1421926) that the read code for
REG_ADDR_HIGH reads off the end of the buffer, because it does a
32-bit read from byte 4 of a 6-byte buffer.
The code also has an endianness issue for both REG_ADDR_HIGH and
REG_ADDR_LOW, because it will do the wrong thing on a big-endian
host.
Rewrite the read code to use ldl_le_p() and lduw_le_p() to fix this;
the write code is not incorrect, but for consistency we make it use
stl_le_p() and stw_le_p().
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions