target/i386: return an error for invalid CPU in hmp_mce()
Rather than silently doing nothing. Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20260828-qemu-no-hmp-v5-6-9227de146347@redhat.com>
Marc-André Lureau committed
Aug 28, 2026 at 16:04 UTC
23733225508272260b86ce7a49ee7c93e3e724e6
1 file changed
+4
-2
target/i386/monitor.c
+4
-2
@@ -586,10 +586,12 @@ void hmp_mce(Monitor *mon, const QDict *qdict)
586
flags |= MCE_INJECT_BROADCAST;
587
}
588
cs = qemu_get_cpu(cpu_index);
589
- if (cs != NULL) {
589
+ if (cs) {
590
cpu = X86_CPU(cs);
591
cpu_x86_inject_mce(cpu, bank, status, mcg_status, addr, misc,
592
flags, &err);
593
- hmp_handle_error(mon, err);
593
+ } else {
594
+ error_setg(&err, "Invalid CPU %d", cpu_index);
595
}
596
+ hmp_handle_error(mon, err);
597
}