summaryrefslogtreecommitdiffstats
path: root/hw/misc/zynq-xadc.c
diff options
context:
space:
mode:
authorPeter Crosthwaite2016-01-21 15:15:04 +0100
committerPeter Maydell2016-01-21 15:15:04 +0100
commit4a94fc9bf2dac5965acb8e264d55a356737a2aa6 (patch)
tree30614e2da3c743f9fe406f61d3086f2410e7facc /hw/misc/zynq-xadc.c
parentxlnx-ep108: Connect the SPI Flash (diff)
downloadqemu-4a94fc9bf2dac5965acb8e264d55a356737a2aa6.tar.gz
qemu-4a94fc9bf2dac5965acb8e264d55a356737a2aa6.tar.xz
qemu-4a94fc9bf2dac5965acb8e264d55a356737a2aa6.zip
misc: zynq-xadc: Fix off-by-one
This bounds check was off-by-one. Fix. Reported-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Message-id: 1453101737-11255-1-git-send-email-crosthwaite.peter@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/misc/zynq-xadc.c')
-rw-r--r--hw/misc/zynq-xadc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/misc/zynq-xadc.c b/hw/misc/zynq-xadc.c
index 1a32595455..d160ff2361 100644
--- a/hw/misc/zynq-xadc.c
+++ b/hw/misc/zynq-xadc.c
@@ -220,7 +220,7 @@ static void zynq_xadc_write(void *opaque, hwaddr offset, uint64_t val,
break;
}
- if (xadc_reg > ZYNQ_XADC_NUM_ADC_REGS && xadc_cmd != CMD_NOP) {
+ if (xadc_reg >= ZYNQ_XADC_NUM_ADC_REGS && xadc_cmd != CMD_NOP) {
qemu_log_mask(LOG_GUEST_ERROR, "read/write op to invalid xadc "
"reg 0x%x\n", xadc_reg);
break;