From: Prasad J Pandit Date: Wed, 12 Oct 2016 12:37:41 +0000 (+0530) Subject: dma: rc4030: limit interval timer reload value X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=c0a3172fa6bbddcc73192f2a2c48d0bf3a7ba61c;p=qemu.git dma: rc4030: limit interval timer reload value The JAZZ RC4030 chipset emulator has a periodic timer and associated interval reload register. The reload value is used as divider when computing timer's next tick value. If reload value is large, it could lead to divide by zero error. Limit the interval reload value to avoid it. Reported-by: Huawei PSIRT Signed-off-by: Prasad J Pandit Tested-by: Hervé Poussineau Signed-off-by: Yongbok Kim --- diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c index 17c8518fea..41fc043464 100644 --- a/hw/dma/rc4030.c +++ b/hw/dma/rc4030.c @@ -460,7 +460,7 @@ static void rc4030_write(void *opaque, hwaddr addr, uint64_t data, break; /* Interval timer reload */ case 0x0228: - s->itr = val; + s->itr = val & 0x01FF; qemu_irq_lower(s->timer_irq); set_next_tick(s); break;