diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2018-06-29 16:30:28 -0700 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2018-07-02 08:09:49 -0700 |
commit | 9c8c334b0637bf3c592d432b0c11f3b62dd5dba3 (patch) | |
tree | ec6ea7cfde5c068f8ef635e3702a1f8d8dccdb57 /include/qom | |
parent | 68fea038553039e53d425c6399202d13f1e5cfb8 (diff) | |
download | qemu-9c8c334b0637bf3c592d432b0c11f3b62dd5dba3.zip |
cpu: Assert asidx_from_attrs return value in range
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'include/qom')
-rw-r--r-- | include/qom/cpu.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/qom/cpu.h b/include/qom/cpu.h index cce2fd6acc..bd796579ee 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -620,11 +620,13 @@ static inline hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr) static inline int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs) { CPUClass *cc = CPU_GET_CLASS(cpu); + int ret = 0; if (cc->asidx_from_attrs) { - return cc->asidx_from_attrs(cpu, attrs); + ret = cc->asidx_from_attrs(cpu, attrs); + assert(ret < cpu->num_ases && ret >= 0); } - return 0; + return ret; } #endif |