summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell2016-04-08 14:45:52 +0200
committerPeter Maydell2016-04-08 14:45:52 +0200
commit9628af036fade986dcc94f4484bc75c6b1a06d84 (patch)
tree24babaf00fbd736895c53d07826b08ddb7071a1a /hw
parentMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (diff)
parenthw/mips_itu: fix off-by-one reported by Coverity (diff)
downloadqemu-9628af036fade986dcc94f4484bc75c6b1a06d84.tar.gz
qemu-9628af036fade986dcc94f4484bc75c6b1a06d84.tar.xz
qemu-9628af036fade986dcc94f4484bc75c6b1a06d84.zip
Merge remote-tracking branch 'remotes/lalrae/tags/mips-20160408' into staging
MIPS patches 2016-04-08 Changes: * fix off-by-one error in ITU # gpg: Signature made Fri 08 Apr 2016 10:43:16 BST using RSA key ID 0B29DA6B # gpg: Good signature from "Leon Alrae <leon.alrae@imgtec.com>" * remotes/lalrae/tags/mips-20160408: hw/mips_itu: fix off-by-one reported by Coverity Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/misc/mips_itu.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/hw/misc/mips_itu.c b/hw/misc/mips_itu.c
index 8461d2379b..da5455062d 100644
--- a/hw/misc/mips_itu.c
+++ b/hw/misc/mips_itu.c
@@ -66,18 +66,13 @@ static uint64_t itc_tag_read(void *opaque, hwaddr addr, unsigned size)
{
MIPSITUState *tag = (MIPSITUState *)opaque;
uint64_t index = addr >> 3;
- uint64_t ret = 0;
- switch (index) {
- case 0 ... ITC_ADDRESSMAP_NUM:
- ret = tag->ITCAddressMap[index];
- break;
- default:
+ if (index >= ITC_ADDRESSMAP_NUM) {
qemu_log_mask(LOG_GUEST_ERROR, "Read 0x%" PRIx64 "\n", addr);
- break;
+ return 0;
}
- return ret;
+ return tag->ITCAddressMap[index];
}
static void itc_reconfigure(MIPSITUState *tag)