qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] misc: zynq-xadc: Fix off-by-one
@ 2016-01-18  7:22 Peter Crosthwaite
  2016-01-18 11:42 ` [Qemu-devel] [Qemu-arm] " Peter Maydell
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Crosthwaite @ 2016-01-18  7:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Peter Crosthwaite, qemu-arm, linux, alistair.francis

This bounds check was off-by-one. Fix.

Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---
 hw/misc/zynq-xadc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/misc/zynq-xadc.c b/hw/misc/zynq-xadc.c
index 1a32595..d160ff2 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;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [Qemu-arm] [PATCH] misc: zynq-xadc: Fix off-by-one
  2016-01-18  7:22 [Qemu-devel] [PATCH] misc: zynq-xadc: Fix off-by-one Peter Crosthwaite
@ 2016-01-18 11:42 ` Peter Maydell
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2016-01-18 11:42 UTC (permalink / raw)
  To: Peter Crosthwaite
  Cc: Paolo Bonzini, qemu-arm, QEMU Developers, Guenter Roeck,
	Alistair Francis

On 18 January 2016 at 07:22, Peter Crosthwaite
<crosthwaitepeter@gmail.com> wrote:
> This bounds check was off-by-one. Fix.
>
> Reported-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
> ---
>  hw/misc/zynq-xadc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/misc/zynq-xadc.c b/hw/misc/zynq-xadc.c
> index 1a32595..d160ff2 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;
> --
> 1.9.1



Applied to target-arm.next, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-18 11:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-18  7:22 [Qemu-devel] [PATCH] misc: zynq-xadc: Fix off-by-one Peter Crosthwaite
2016-01-18 11:42 ` [Qemu-devel] [Qemu-arm] " Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).