From 9297e6402f6aa1b52e5577edc875eb2d2163baeb Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 7 Dec 2009 12:25:54 +0000 Subject: [PATCH] passthrough: Fix no_wb not to crash on unknown registers e2b98415256cb264bc25e6df539ec0dc9d1b85b0 broke things sometimes: If pt_find_reg_grp() fails and returns NULL, it will jump to out:, but at this time reg is still NULL (pt_find_reg() is not reached) which leads to a NULL dereference. This patch fixes it. Submitted-By: Qing He Signed-off-by: Ian Jackson --- hw/pass-through.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pass-through.c b/hw/pass-through.c index b125d7222..e7bd38602 100644 --- a/hw/pass-through.c +++ b/hw/pass-through.c @@ -1556,7 +1556,7 @@ static void pt_pci_write_config(PCIDevice *d, uint32_t address, uint32_t val, val >>= ((address & 3) << 3); out: - if (!reg->no_wb) { + if (!(reg && reg->no_wb)) { /* unknown regs are passed through */ ret = pci_write_block(pci_dev, address, (uint8_t *)&val, len); if (!ret) -- 2.39.5