[PATCH v3 05/49] target/i386: return an error for invalid CPU in hmp_mce()
Marc-André Lureau <[email protected]>
| Newsgroups | org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
Rather than silently doing nothing. Suggested-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Daniel P. Berrangé <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Marc-André Lureau <[email protected]> --- target/i386/monitor.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 785a13dd7107..9ed772e6d7f2 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -586,10 +586,12 @@ void hmp_mce(Monitor *mon, const QDict *qdict) flags |= MCE_INJECT_BROADCAST; } cs = qemu_get_cpu(cpu_index); - if (cs != NULL) { + if (cs) { cpu = X86_CPU(cs); cpu_x86_inject_mce(cpu, bank, status, mcg_status, addr, misc, flags, &err); - hmp_handle_error(mon, err); + } else { + error_setg(&err, "Invalid CPU %d", cpu_index); } + hmp_handle_error(mon, err); } -- 2.55.0.543.g5ebe2ebe4ea8