mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-07-21 18:34:33 +00:00
softmmu: Assert data in bounds in iotlb_to_section
Acked-by: Alex Bennée <alex.bennee@linaro.org> Suggested-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
813bac3d8d
commit
86e4f93d82
|
@ -2413,9 +2413,15 @@ MemoryRegionSection *iotlb_to_section(CPUState *cpu,
|
||||||
int asidx = cpu_asidx_from_attrs(cpu, attrs);
|
int asidx = cpu_asidx_from_attrs(cpu, attrs);
|
||||||
CPUAddressSpace *cpuas = &cpu->cpu_ases[asidx];
|
CPUAddressSpace *cpuas = &cpu->cpu_ases[asidx];
|
||||||
AddressSpaceDispatch *d = qatomic_rcu_read(&cpuas->memory_dispatch);
|
AddressSpaceDispatch *d = qatomic_rcu_read(&cpuas->memory_dispatch);
|
||||||
MemoryRegionSection *sections = d->map.sections;
|
int section_index = index & ~TARGET_PAGE_MASK;
|
||||||
|
MemoryRegionSection *ret;
|
||||||
|
|
||||||
return §ions[index & ~TARGET_PAGE_MASK];
|
assert(section_index < d->map.sections_nb);
|
||||||
|
ret = d->map.sections + section_index;
|
||||||
|
assert(ret->mr);
|
||||||
|
assert(ret->mr->ops);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void io_mem_init(void)
|
static void io_mem_init(void)
|
||||||
|
|
Loading…
Reference in a new issue