[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 01/16] hpet: Catch out-of-bounds timer access
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] [PATCH 01/16] hpet: Catch out-of-bounds timer access |
Date: |
Sun, 6 Jun 2010 10:10:50 +0200 |
From: Jan Kiszka <address@hidden>
Also prevent out-of-bounds write access to the timers but don't spam the
host console if it triggers.
Signed-off-by: Jan Kiszka <address@hidden>
---
hw/hpet.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/hw/hpet.c b/hw/hpet.c
index 8729fb2..1980906 100644
--- a/hw/hpet.c
+++ b/hw/hpet.c
@@ -294,7 +294,7 @@ static uint32_t hpet_ram_readl(void *opaque,
target_phys_addr_t addr)
if (index >= 0x100 && index <= 0x3ff) {
uint8_t timer_id = (addr - 0x100) / 0x20;
if (timer_id > HPET_NUM_TIMERS - 1) {
- printf("qemu: timer id out of range\n");
+ DPRINTF("qemu: timer id out of range\n");
return 0;
}
HPETTimer *timer = &s->timer[timer_id];
@@ -383,6 +383,10 @@ static void hpet_ram_writel(void *opaque,
target_phys_addr_t addr,
DPRINTF("qemu: hpet_ram_writel timer_id = %#x \n", timer_id);
HPETTimer *timer = &s->timer[timer_id];
+ if (timer_id > HPET_NUM_TIMERS - 1) {
+ DPRINTF("qemu: timer id out of range\n");
+ return;
+ }
switch ((addr - 0x100) % 0x20) {
case HPET_TN_CFG:
DPRINTF("qemu: hpet_ram_writel HPET_TN_CFG\n");
--
1.6.0.2
- [Qemu-devel] [PATCH 00/16] HPET cleanups, fixes, enhancements, Jan Kiszka, 2010/06/06
- [Qemu-devel] [PATCH 01/16] hpet: Catch out-of-bounds timer access,
Jan Kiszka <=
- [Qemu-devel] [PATCH 04/16] hpet: Move static timer field initialization, Jan Kiszka, 2010/06/06
- [Qemu-devel] [PATCH 05/16] hpet: Convert to qdev, Jan Kiszka, 2010/06/06
- [Qemu-devel] [PATCH 03/16] hpet: Silence warning on write to running main counter, Jan Kiszka, 2010/06/06
- [Qemu-devel] [PATCH 07/16] monitor/QMP: Drop info hpet / query-hpet, Jan Kiszka, 2010/06/06
- [Qemu-devel] [PATCH 02/16] hpet: Coding style cleanups and some refactorings, Jan Kiszka, 2010/06/06
- [Qemu-devel] [PATCH 06/16] hpet: Start/stop timer when HPET_TN_ENABLE is modified, Jan Kiszka, 2010/06/06
- [Qemu-devel] [PATCH 09/16] Enable message delivery via IRQs, Jan Kiszka, 2010/06/06