aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-04-08 13:45:52 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-04-08 13:45:52 +0100
commit9628af036fade986dcc94f4484bc75c6b1a06d84 (patch)
tree24babaf00fbd736895c53d07826b08ddb7071a1a /hw
parent8227e2d16705b8c94df93f465d4e1659c28c69ce (diff)
parentf2eb665a11a34ac9f6459f8a18c3d9d8be9ca359 (diff)
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)