diff options
author | Alon Levy <alevy@redhat.com> | 2012-04-25 12:13:17 +0300 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2012-05-03 10:45:04 +0200 |
commit | 4b635c59b04cae594f49d9aa45d31b3f318def8f (patch) | |
tree | 8fc731fefbb18900aa38ca595425a088cf64b8c2 /hw/qxl.c | |
parent | 4efee029cbd5dc3aaa422edc10447f3659df7754 (diff) | |
download | qemu-4b635c59b04cae594f49d9aa45d31b3f318def8f.zip qemu-4b635c59b04cae594f49d9aa45d31b3f318def8f.tar.gz qemu-4b635c59b04cae594f49d9aa45d31b3f318def8f.tar.bz2 |
hw/qxl.c: qxl_phys2virt: replace panics with guest_bug
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/qxl.c')
-rw-r--r-- | hw/qxl.c | 25 |
1 files changed, 19 insertions, 6 deletions
@@ -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) |