From: Michal Privoznik Date: Tue, 4 Nov 2025 11:25:20 +0000 (+0100) Subject: domain_capabilities: Move indentation adjustment out of virDomainCapsCPUCustomFormat() X-Git-Tag: CVE-2025-12748~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=132ba55a00ef09912badd9de4fcd140dccbcd81c;p=thirdparty%2Flibvirt.git domain_capabilities: Move indentation adjustment out of virDomainCapsCPUCustomFormat() The aim of virDomainCapsCPUCustomFormat() is to format CPU models into given buffer. But it starts by adjusting indentation. Move this one level up into the caller so that another buffer can be used. This also makes the pattern match in the caller (virDomainCapsCPUFormat()) with the rest of CPU related domcaps formatting. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 422b68c085..5a94edf9bc 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -446,8 +446,6 @@ virDomainCapsCPUCustomFormat(virBuffer *buf, { size_t i; - virBufferAdjustIndent(buf, 2); - for (i = 0; i < custom->nmodels; i++) { virDomainCapsCPUModel *model = custom->models + i; @@ -480,8 +478,6 @@ virDomainCapsCPUCustomFormat(virBuffer *buf, virBufferAddLit(buf, "\n"); } } - - virBufferAdjustIndent(buf, -2); } static void @@ -539,7 +535,9 @@ virDomainCapsCPUFormat(virBuffer *buf, virCPUModeTypeToString(VIR_CPU_MODE_CUSTOM)); if (cpu->custom && cpu->custom->nmodels) { virBufferAddLit(buf, "supported='yes'>\n"); + virBufferAdjustIndent(buf, 2); virDomainCapsCPUCustomFormat(buf, cpu->custom); + virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); } else { virBufferAddLit(buf, "supported='no'/>\n");