From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buInB-0007i4-Cp for qemu-devel@nongnu.org; Wed, 12 Oct 2016 08:37:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1buIn6-0005DF-2M for qemu-devel@nongnu.org; Wed, 12 Oct 2016 08:37:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33162) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buIn5-0005D4-S1 for qemu-devel@nongnu.org; Wed, 12 Oct 2016 08:37:47 -0400 From: P J P Date: Wed, 12 Oct 2016 18:07:41 +0530 Message-Id: <1476275861-27613-1-git-send-email-ppandit@redhat.com> Subject: [Qemu-devel] [PATCH] dma: rc4030: limit interval timer reload value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Qemu Developers Cc: "Michael S. Tsirkin" , Paolo Bonzini , Huawei PSIRT , Prasad J Pandit From: Prasad J Pandit 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 --- hw/dma/rc4030.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c index 2f2576f..c1b4997 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; -- 2.5.5