From: Alon Levy Date: Wed, 25 Apr 2012 09:13:17 +0000 (+0300) Subject: hw/qxl.c: qxl_phys2virt: replace panics with guest_bug X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~4128^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b635c59b04cae594f49d9aa45d31b3f318def8f;p=sdk%2Femulator%2Fqemu.git hw/qxl.c: qxl_phys2virt: replace panics with guest_bug Signed-off-by: Alon Levy Signed-off-by: Gerd Hoffmann --- 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)