提交 4b635c59 编写于 作者: A Alon Levy 提交者: Gerd Hoffmann

hw/qxl.c: qxl_phys2virt: replace panics with guest_bug

Signed-off-by: NAlon Levy <alevy@redhat.com>
Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
上级 4efee029
...@@ -1097,15 +1097,28 @@ void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL pqxl, int group_id) ...@@ -1097,15 +1097,28 @@ void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL pqxl, int group_id)
case MEMSLOT_GROUP_HOST: case MEMSLOT_GROUP_HOST:
return (void *)(intptr_t)offset; return (void *)(intptr_t)offset;
case MEMSLOT_GROUP_GUEST: case MEMSLOT_GROUP_GUEST:
PANIC_ON(slot >= NUM_MEMSLOTS); if (slot >= NUM_MEMSLOTS) {
PANIC_ON(!qxl->guest_slots[slot].active); qxl_guest_bug(qxl, "slot too large %d >= %d", slot, NUM_MEMSLOTS);
PANIC_ON(offset < qxl->guest_slots[slot].delta); 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; 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; return qxl->guest_slots[slot].ptr + offset;
default:
PANIC_ON(1);
} }
return NULL;
} }
static void qxl_create_guest_primary_complete(PCIQXLDevice *qxl) static void qxl_create_guest_primary_complete(PCIQXLDevice *qxl)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册