summaryrefslogtreecommitdiffstats
path: root/memory.c
diff options
context:
space:
mode:
authorPeter Maydell2016-07-04 14:06:35 +0200
committerPeter Maydell2016-07-04 14:06:35 +0200
commit39e0b03dec518254fabd2acff29548d3f1d2b754 (patch)
tree2f7ed6995935901c71b451261c67d89637ec20ff /memory.c
parentimx: Use memory_region_init_rom() for ROMs (diff)
downloadqemu-39e0b03dec518254fabd2acff29548d3f1d2b754.tar.gz
qemu-39e0b03dec518254fabd2acff29548d3f1d2b754.tar.xz
qemu-39e0b03dec518254fabd2acff29548d3f1d2b754.zip
memory: Assert that memory_region_init_rom_device() ops aren't NULL
It doesn't make sense to pass a NULL ops argument to memory_region_init_rom_device(), because the effect will be that if the guest tries to write to the memory region then QEMU will segfault. Catch the bug earlier by sanity checking the arguments to this function, and remove the misleading documentation that suggests that passing NULL might be sensible. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1467122287-24974-4-git-send-email-peter.maydell@linaro.org
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/memory.c b/memory.c
index ecb565ea81..0eb6895fe6 100644
--- a/memory.c
+++ b/memory.c
@@ -1399,6 +1399,7 @@ void memory_region_init_rom_device(MemoryRegion *mr,
uint64_t size,
Error **errp)
{
+ assert(ops);
memory_region_init(mr, owner, name, size);
mr->ops = ops;
mr->opaque = opaque;