From 2aa644a2fc8f1e9cd68bd4920bf3501f1a9cc506 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 4 Nov 2024 18:04:29 +0100 Subject: [PATCH] qemuPrepareNVRAM: Refuse conversion of NVRAM backing file format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refuse situations where the user configures a different format for a file-backed nvram than the template file has. At this point it's still required that the NVRAM and firmware share format, but that is going to be relaxed, thus we need to refuse configurations that the code can't handle. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik Reviewed-by: Ján Tomko --- src/qemu/qemu_process.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 7a40e09d47..d134de532c 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4624,6 +4624,12 @@ qemuPrepareNVRAM(virQEMUDriver *driver, return -1; } + if (loader->nvram->format != loader->nvramTemplateFormat) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("conversion of the nvram template to another target format is not supported")); + return -1; + } + if ((srcFD = virFileOpenAs(loader->nvramTemplate, O_RDONLY, 0, -1, -1, 0)) < 0) { virReportSystemError(-srcFD,