qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] dma: rc4030: limit interval timer reload value
@ 2016-10-12 12:37 P J P
  2016-11-10  5:56 ` Gonglei (Arei)
  0 siblings, 1 reply; 10+ messages in thread
From: P J P @ 2016-10-12 12:37 UTC (permalink / raw)
  To: Qemu Developers
  Cc: Michael S. Tsirkin, Paolo Bonzini, Huawei PSIRT, Prasad J Pandit

From: Prasad J Pandit <pjp@fedoraproject.org>

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 <psirt@huawei.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
---
 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

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

end of thread, other threads:[~2017-03-14 19:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-12 12:37 [Qemu-devel] [PATCH] dma: rc4030: limit interval timer reload value P J P
2016-11-10  5:56 ` Gonglei (Arei)
2016-11-10 14:50   ` Paolo Bonzini
2016-11-16  5:50     ` Hervé Poussineau
2016-11-16  6:03       ` Gonglei (Arei)
2016-11-16  6:29       ` P J P
2016-11-16  6:37         ` Hervé Poussineau
2016-11-17 11:48         ` Paolo Bonzini
2017-03-14 19:17       ` Cole Robinson
2017-03-14 19:35         ` 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).