|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] x86/boot: Fix domain_cmdline_size()
commit 3998da124ac046d0d95d919f3bb8a394b287dc55
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed Jun 4 00:33:46 2025 +0100
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Fri Jun 13 15:47:18 2025 +0100
x86/boot: Fix domain_cmdline_size()
The early exit from domain_cmdline_size() is buggy. Even if there's no
bootloader cmdline and no kextra, there still might be Xen parameters to
forward, and therefore a nonzero cmdline length.
Explain what the function is doing, and rewrite it to be both more legible
and
more extendible.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
xen/arch/x86/setup.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 1f5cb67bd0..d47b99f1b2 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -980,15 +980,22 @@ static unsigned int __init copy_bios_e820(struct
e820entry *map, unsigned int li
return n;
}
+/*
+ * Calculate the maximum possible size of the dom0 cmdline. Pieces of the
+ * dom0 cmdline optionally come from the bootloader directly, from Xen's
+ * cmdline (following " -- "), and individual Xen parameters are forwarded
+ * too.
+ */
static size_t __init domain_cmdline_size(const struct boot_info *bi,
const struct boot_domain *bd)
{
- size_t s = bi->kextra ? strlen(bi->kextra) : 0;
+ size_t s = 0;
- s += bd->kernel->cmdline_pa ? strlen(__va(bd->kernel->cmdline_pa)) : 0;
+ if ( bd->kernel->cmdline_pa )
+ s += strlen(__va(bd->kernel->cmdline_pa));
- if ( s == 0 )
- return s;
+ if ( bi->kextra )
+ s += strlen(bi->kextra);
/*
* Certain parameters from the Xen command line may be added to the dom0
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |