]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/qemu-xen.git/commitdiff
misc: zynq-xadc: Fix off-by-one
authorPeter Crosthwaite <crosthwaitepeter@gmail.com>
Thu, 21 Jan 2016 14:15:04 +0000 (14:15 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 21 Jan 2016 14:15:04 +0000 (14:15 +0000)
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>
hw/misc/zynq-xadc.c

index 1a325954559cc8030c7cf54b0a947528d8c5d629..d160ff2361bfa2d79dcd204c031558667a84ad99 100644 (file)
@@ -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;