[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/9] hw/qxl.c: qxl_phys2virt: replace panics with gu
From: |
Alon Levy |
Subject: |
[Qemu-devel] [PATCH 1/9] hw/qxl.c: qxl_phys2virt: replace panics with guest_bug |
Date: |
Wed, 25 Apr 2012 12:13:17 +0300 |
Signed-off-by: Alon Levy <address@hidden>
---
hw/qxl.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/hw/qxl.c b/hw/qxl.c
index c3540c3..9e8cdf3 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1097,15 +1097,28 @@ void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL
pqxl, int group_id)
case MEMSLOT_GROUP_HOST:
return (void *)(intptr_t)offset;
case MEMSLOT_GROUP_GUEST:
- PANIC_ON(slot >= NUM_MEMSLOTS);
- PANIC_ON(!qxl->guest_slots[slot].active);
- PANIC_ON(offset < qxl->guest_slots[slot].delta);
+ if (slot >= NUM_MEMSLOTS) {
+ qxl_guest_bug(qxl, "slot too large %d >= %d", slot, NUM_MEMSLOTS);
+ return NULL;
+ }
+ if (!qxl->guest_slots[slot].active) {
+ qxl_guest_bug(qxl, "inactive slot %d\n", slot);
+ return NULL;
+ }
+ if (offset < qxl->guest_slots[slot].delta) {
+ qxl_guest_bug(qxl, "slot %d offset %"PRIu64" < delta %"PRIu64"\n",
+ slot, offset, qxl->guest_slots[slot].delta);
+ return NULL;
+ }
offset -= qxl->guest_slots[slot].delta;
- PANIC_ON(offset > qxl->guest_slots[slot].size)
+ if (offset > qxl->guest_slots[slot].size) {
+ qxl_guest_bug(qxl, "slot %d offset %"PRIu64" > size %"PRIu64"\n",
+ slot, offset, qxl->guest_slots[slot].size);
+ return NULL;
+ }
return qxl->guest_slots[slot].ptr + offset;
- default:
- PANIC_ON(1);
}
+ return NULL;
}
static void qxl_create_guest_primary_complete(PCIQXLDevice *qxl)
--
1.7.10
- Re: [Qemu-devel] [RFC] qxl: don't panic on phys2virt, Gerd Hoffmann, 2012/04/24
- [Qemu-devel] [PATCH 1/9] hw/qxl.c: qxl_phys2virt: replace panics with guest_bug,
Alon Levy <=
- [Qemu-devel] [PATCH 2/9] qxl: check for NULL return from qxl_phys2virt, Alon Levy, 2012/04/25
- [Qemu-devel] [PATCH 3/9] qxl: replace panic with guest bug in qxl_track_command, Alon Levy, 2012/04/25
- [Qemu-devel] [PATCH 4/9] qxl: fix > 80 chars line, Alon Levy, 2012/04/25
- [Qemu-devel] [PATCH 5/9] qxl: don't abort on guest trigerrable ring indices mismatch, Alon Levy, 2012/04/25
- [Qemu-devel] [PATCH 6/9] qxl: cleanup s/__FUNCTION__/__func__/, Alon Levy, 2012/04/25
- [Qemu-devel] [PATCH 7/9] qxl: interface_notify_update: remove guest trigerrable abort, Alon Levy, 2012/04/25
- [Qemu-devel] [PATCH 8/9] qxl: qxl_add_memslot: remove guest trigerrable panics, Alon Levy, 2012/04/25