Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 28795C5AD49 for ; Wed, 28 May 2025 16:03:49 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uKJFY-0001N5-Ol; Wed, 28 May 2025 12:03:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uKJFK-0001LJ-79 for grub-devel@gnu.org; Wed, 28 May 2025 12:03:14 -0400 Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uKJFG-0001Zv-5q for grub-devel@gnu.org; Wed, 28 May 2025 12:03:13 -0400 Received: by mail-io1-xd2b.google.com with SMTP id ca18e2360f4ac-8643cc66903so15104739f.0 for ; Wed, 28 May 2025 09:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748448172; x=1749052972; darn=gnu.org; h=mime-version:references:in-reply-to:message-id:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=GedbIvCvPrax94A6Oj69Nh9gVAwfSXVp4MylijmyZ3Q=; b=Wmg2fBU+nlj0eECDFBJ9exU9NextfkhIAOhEx/Z1d0QZrrmmEh2Eb6woHkExO+STHD S16GZkp9kcxUAmo+q4nDJGek2/X29ygSSbyHJ/bac2vYhtWC+b6sSH4ZbYaPj60bDMy2 dxp+WVdbI1m72xlrAqS5hp9z10HxLWd+YDrWZrTrsDT7BVQrN2pTd5tCrXMltZmbFR2z 6wJLJGMQKK46f+M6O473BaqcEDyKstA/x3TsuyFBezWx+ydh5Mvs+J/uHqNcnTWzVqDr BTQBIKKCU4t4rf4AdxXrGOaz5CA5/4OskyZoeya2ISWaFSTseZ/bWNRe08TNTCPZthch jd3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748448172; x=1749052972; h=mime-version:references:in-reply-to:message-id:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=GedbIvCvPrax94A6Oj69Nh9gVAwfSXVp4MylijmyZ3Q=; b=HaYwBHvAOgDdTpY/iGXevp+BTJQFF10T/8cFS8oHVDiCyTdQ/wAZNFosIzIoXxyhk9 laYZwIQzC5jsEK79P3F7PVjANI6ENa3oA/bEi7H3KxH6+jXCl+Gu2P2PIh4s9OjO+fGP rlW0yI23T+9AYzw+t2FalHtO/IJbbB+YrqPwi6daYNJZsafakBzVqdtX0CqPeXWwga6c Zgk8mMWKtV7Bt8CC/vcFkDshVBgB8oQ8oOY84H+GRr10Ap5k4GVPoTo+k5atqOCEzzlP eJBZsTYNFFjVC/1MO+ZX5A5SfcGgFj02/t8lQaX6aMNuUKZ1T3kP9E7L4hqFDDtp3FQf SDSg== X-Gm-Message-State: AOJu0YyYsk8w3b2GxULyOWKTn8lFvBfvWT04aJzmQozvHeK7mUmkpnXl EReHDHIlTbjr2G2kkEhnTr2xNC8Dgp5qR0Ob4ra76elksdR4QEpvzsDd X-Gm-Gg: ASbGncsW05NSRaT5j+kqBSAoNaxPc474mwkpA4188UU6RNTaucNot4WKG8PHHiSyjFh ixdsTpTVEMFVRzDx62DFMXeDYkEZGeqg9E7owgK4vns0kdJC+jCyJX/DqjOIhm1vJHf5phNpqhY qClvnzV8rCmYs7nofDMvzUfHDPdlGKQ23Eljo0r/uwpKw8VNiq7ihn3EP2+tWG447gYemuFup+3 cVY+yp8iIOT9YL9X/umsXlO6njqAsfiB/r2wi9gQzjGC6eSqjFNs7k5S6hqto+3rVlJHeZhPF3m SJYZPGBOXs66T6Ul84+ID6eO4Xl1Te7M9Bu1RIEZgnBOSfMowQ== X-Google-Smtp-Source: AGHT+IF43Sv5kMP2DH/BCh/wiFUfTr+OuqMVqU4RJ2Eu4N62QjU7b50ybyscVV3jogUPyvfLvTrb0Q== X-Received: by 2002:a05:6602:6c01:b0:85a:fe80:cdd1 with SMTP id ca18e2360f4ac-86cbb6c1cd7mr505687439f.0.1748448171694; Wed, 28 May 2025 09:02:51 -0700 (PDT) Received: from kf-m2g5 ([2607:fb90:6d88:4020:e7d0:b732:e526:6ec1]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4fdbd5a7aedsm272660173.111.2025.05.28.09.02.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 May 2025 09:02:51 -0700 (PDT) Date: Wed, 28 May 2025 11:02:40 -0500 From: Aaron Rainbolt To: Daniel Kiper Cc: grub-devel@gnu.org Subject: Re: [PATCH 1/1] Add Xen command line parsing Message-ID: <20250528110240.3983c6ce@kf-m2g5> In-Reply-To: <20250528151219.yk2h3c3spqxb4mve@tomti.i.net-space.pl> References: <20250423214615.23d46d47@kf-m2g5> <20250423214748.0e6f2ee1@kf-m2g5> <20250528151219.yk2h3c3spqxb4mve@tomti.i.net-space.pl> X-Mailer: Claws Mail 4.3.1 (GTK 3.24.41; x86_64-pc-linux-gnu) MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::d2b; envelope-from=arraybolt3@gmail.com; helo=mail-io1-xd2b.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The development of GNU GRUB Content-Type: multipart/mixed; boundary="===============2792701298245972105==" Errors-To: grub-devel-bounces+grub-devel=archiver.kernel.org@gnu.org Sender: grub-devel-bounces+grub-devel=archiver.kernel.org@gnu.org --===============2792701298245972105== Content-Type: multipart/signed; boundary="Sig_/YobrJK5YYpWbvtioCb4wAUl"; protocol="application/pgp-signature"; micalg=pgp-sha512 --Sig_/YobrJK5YYpWbvtioCb4wAUl Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Wed, 28 May 2025 17:12:19 +0200 Daniel Kiper wrote: > First of all, next time please add Xen-devel ML to recipients too... Apologies, didn't realize that list would be appropriate. I will add them in the next version of the patch. > On Wed, Apr 23, 2025 at 09:47:48PM -0500, Aaron Rainbolt wrote: > > Enable GRUB to parse the Xen command line for parameters, and expose > > certain of those parameters to the GRUB config file (or rescue > > shell) as environment variables. =20 >=20 > Please make the commit message more verbose, i.e., explain why this > feature it is needed, how it works, etc. >=20 > > --- > > grub-core/Makefile.core.def | 2 + > > grub-core/kern/i386/xen/pvh.c | 16 ++ > > grub-core/kern/main.c | 12 ++ > > grub-core/kern/xen/cmdline.c | 270 > > ++++++++++++++++++++++++++++++++++ include/grub/xen.h | > > 2 + =20 >=20 > I think this feature should have a description in the GRUB docs. >=20 > > 5 files changed, 302 insertions(+) > > create mode 100644 grub-core/kern/xen/cmdline.c > > > > diff --git a/grub-core/Makefile.core.def > > b/grub-core/Makefile.core.def index f70e02e69..79e681a7b 100644 > > --- a/grub-core/Makefile.core.def > > +++ b/grub-core/Makefile.core.def > > @@ -248,6 +248,7 @@ kernel =3D { > > xen =3D term/xen/console.c; > > xen =3D disk/xen/xendisk.c; > > xen =3D commands/boot.c; > > + xen =3D kern/xen/cmdline.c; > > > > i386_xen_pvh =3D commands/boot.c; > > i386_xen_pvh =3D disk/xen/xendisk.c; > > @@ -255,6 +256,7 @@ kernel =3D { > > i386_xen_pvh =3D kern/i386/xen/tsc.c; > > i386_xen_pvh =3D kern/i386/xen/pvh.c; > > i386_xen_pvh =3D kern/xen/init.c; > > + i386_xen_pvh =3D kern/xen/cmdline.c; > > i386_xen_pvh =3D term/xen/console.c; > > > > ia64_efi =3D kern/ia64/efi/startup.S; > > diff --git a/grub-core/kern/i386/xen/pvh.c > > b/grub-core/kern/i386/xen/pvh.c index 91fbca859..9fb048082 100644 > > --- a/grub-core/kern/i386/xen/pvh.c > > +++ b/grub-core/kern/i386/xen/pvh.c > > @@ -352,6 +352,22 @@ grub_xen_setup_pvh (void) > > grub_xen_mm_init_regions (); > > > > grub_rsdp_addr =3D pvh_start_info->rsdp_paddr; > > + int xen_cmdline_fits =3D 0; =20 >=20 > We have bool type in the GRUB. >=20 > > + char *xen_cmdline =3D (char *) pvh_start_info->cmdline_paddr; =20 >=20 > const char? >=20 > And please add an empty line here. >=20 > > + for (int i =3D 0; i < 1024; i++) =20 >=20 > 1024? Where this number come from? And I suggest using constants where > possible. 1024 is the maximum Xen command line length specified by include/xen/xen.h. I think I can just use the MAX_GUEST_CMDLINE define set by that file here, is that acceptable? > Additionally, please do not mix code with variable definitions. Define > all variables at the beginning of a function or block. Will do, but this should probably be added to the coding style documentation at some point in the future. (It looks like a lot of the issues with this patch are coding style issues that I could have avoided had the details been documented.) > > + { > > + if (xen_cmdline[i] =3D=3D '\0') > > + { > > + xen_cmdline_fits =3D 1; > > + break; > > + } > > + } > > + if (xen_cmdline_fits =3D=3D 1) =20 >=20 > Probably this and xen_cmdline_fits variable is not needed if you merge > the code below with the code above. >=20 > > + { > > + grub_strncpy ((char *) grub_xen_start_page_addr->cmd_line, > > + (char *) pvh_start_info->cmdline_paddr, > > + MAX_GUEST_CMDLINE); > > + } > > } > > > > grub_err_t > > diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c > > index 143a232b8..f96b16f73 100644 > > --- a/grub-core/kern/main.c > > +++ b/grub-core/kern/main.c > > @@ -40,6 +40,10 @@ > > static bool cli_disabled =3D false; > > static bool cli_need_auth =3D false; > > > > +#if defined (GRUB_MACHINE_XEN) || defined (GRUB_MACHINE_XEN_PVH) > > +#include > > +#endif > > + > > grub_addr_t > > grub_modules_get_end (void) > > { > > @@ -351,6 +355,14 @@ grub_main (void) > > grub_env_export ("root"); > > grub_env_export ("prefix"); > > > > + /* > > + * Parse command line parameters from Xen and export them as > > environment > > + * variables > > + */ > > +#if defined (GRUB_MACHINE_XEN) || defined (GRUB_MACHINE_XEN_PVH) > > + grub_parse_xen_cmdline (); > > +#endif > > + > > /* Reclaim space used for modules. */ > > reclaim_module_space (); > > > > diff --git a/grub-core/kern/xen/cmdline.c > > b/grub-core/kern/xen/cmdline.c new file mode 100644 > > index 000000000..0084f3e77 > > --- /dev/null > > +++ b/grub-core/kern/xen/cmdline.c > > @@ -0,0 +1,270 @@ > > +/* > > + * GRUB -- GRand Unified Bootloader > > + * Copyright (C) 2025 Free Software Foundation, Inc. > > + * > > + * GRUB is free software: you can redistribute it and/or modify > > + * it under the terms of the GNU General Public License as > > published by > > + * the Free Software Foundation, either version 3 of the License, > > or > > + * (at your option) any later version. > > + * > > + * GRUB is distributed in the hope that it will be useful, > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > > + * GNU General Public License for more details. > > + * > > + * You should have received a copy of the GNU General Public > > License > > + * along with GRUB. If not, see . > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > + > > +#define PARSER_HIT_BACKSLASH 0x1 > > +#define PARSER_IN_SINGLE_QUOTES 0x2 > > +#define PARSER_IN_DOUBLE_QUOTES 0x4 > > +#define PARSER_BASE_WORD_LEN 16 =20 >=20 > I think it could be enum type. >=20 > > +grub_size_t word_list_len; > > +char **word_list; > > +grub_size_t current_word_len; > > +grub_size_t current_word_pos; > > +char *current_word; > > +char current_char; > > +grub_size_t param_dict_len; > > +char **param_keys; > > +char **param_vals; =20 >=20 > Probably all of this should be static. >=20 > > +static bool > > +append_char_to_word (bool allow_null) > > +{ > > + if (!(current_char >=3D 0x20) || !(current_char <=3D 0x7E)) =20 >=20 > I know what you mean but please comment why you accept only limited > set of characters. >=20 > > + { > > + if (current_char !=3D '\0' || !allow_null) =20 >=20 > allow_null =3D=3D false please here and in other places too... +1, also might be useful to document. > > + { > > + return false; > > + } =20 >=20 > Please drop unneeded curly brackets... +1, also might be useful to document. > > + } > > + if (current_word_pos =3D=3D current_word_len) > > + { > > + current_word_len *=3D 2; > > + current_word =3D grub_realloc (current_word, > > current_word_len); =20 >=20 > grub_realloc() may fail... I'm embarrassed I forgot to error-check every single memory allocation, I'm too used to languages that immediately crash the program if memory runs out and forget that C will just keep moving forward with a failed allocation if you don't handle it yourself. Thanks for your patience, I'll make sure all these are resolved in the next iteration of the patch. > > + } > > + > > + current_word[current_word_pos] =3D current_char; > > + current_word_pos++; > > + return true; > > +} > > + > > +static void > > +append_word_to_list (void) > > +{ > > + for (grub_size_t i =3D 0; i < current_word_pos; i++) =20 >=20 > Again, please do not mix variable definitions with the code. >=20 > > + { > > + if (current_word[i] <=3D 0x1F || current_word[i] >=3D 0x7F) > > + { > > + grub_free (current_word); > > + goto reset_word; > > + } > > + } > > + current_char =3D '\0'; > > + if (!append_char_to_word (true)) =20 >=20 > append_char_to_word (true) =3D=3D false >=20 > > + { > > + grub_error (GRUB_ERR_BUG, N_("couldn't append null > > terminator to word during Xen cmdline parsing")); =20 >=20 > Please drop N_() from here... Will do, when I wrote this I thought this message needed to be translatable, but in retrospect this should be unreachable code (barring an allocation failure), so if it ever is reached, having an exact string that can be grepped for easily will be valuable. > > + grub_print_error (); > > + grub_exit (); > > + } > > + current_word_len =3D grub_strlen (current_word) + 1; > > + current_word =3D grub_realloc (current_word, current_word_len); =20 >=20 > Please check for errors when you alloc/realloc memory. >=20 > > + word_list_len++; > > + word_list =3D grub_realloc (word_list, word_list_len * sizeof > > (char *)); =20 >=20 > Ditto. >=20 > > + word_list[word_list_len - 1] =3D current_word; > > + > > +reset_word: =20 >=20 > Missing space before label. Also would be good to document as a coding style requirement. > > + current_word_len =3D PARSER_BASE_WORD_LEN; > > + current_word_pos =3D 0; > > + current_word =3D grub_malloc (current_word_len); =20 >=20 > Again, missing error checks are unacceptable. >=20 > > +} > > + > > +int =20 >=20 > s/int/bool/ >=20 > > +check_key_is_safe (char *key, grub_size_t len) > > +{ > > + /* > > + * Ensure only a-z, A-Z, and _ are allowed. > > + */ > > + for (grub_size_t i =3D 0; i < len; i++) > > + { > > + if (! ((key[i] >=3D 'A' && key[i] <=3D 'Z') > > + || (key[i] >=3D 'a' && key[i] <=3D 'z') > > + || (key[i] =3D=3D '_') ) ) =20 >=20 > This "if" begs for comment. The comment is above the "for" loop one line up. I can move it inside the loop if that's preferable. > > + { > > + return 0; > > + } =20 >=20 > Redundant curly braces. >=20 > > + } > > + return 1; > > +} > > + > > +void > > +grub_parse_xen_cmdline (void) > > +{ > > + word_list =3D grub_malloc (0); =20 >=20 > word_list =3D NULL; I was going off of the documentation in `man 3 malloc`, which states "if size is 0, then malloc() returns a unique pointer value that can later be successfully passed to free()`. Looking closer at the memory management code, I see `grub_free()` can handle a null pointer, but wasn't aware of that when writing this, and was trying to avoid a memory management error since this and the other `grub_malloc (0)`'d variables are unconditionally `grub_free`'d in the cleanup section. > > + current_word_len =3D PARSER_BASE_WORD_LEN; > > + current_word =3D grub_malloc (current_word_len); > > + param_keys =3D grub_malloc (0); =20 >=20 > Ditto. >=20 > > + param_vals =3D grub_malloc (0); =20 >=20 > Ditto. >=20 > And why these variables have to be global? It looks like they don't have to be, I thought it was clearer to have them declared in the same place as the other command line parsing state variables though. I'll move them into the function where they are used. > > + grub_uint8_t parse_flags =3D 0; =20 >=20 > Please use enum type instead of grub_uint8_t. >=20 > > + char *cmdline =3D (char *)grub_xen_start_page_addr->cmd_line; =20 >=20 > const char? >=20 > And missing space after ")". Huh, looks like clang-format didn't catch that one for me... or I forgot to re-run it before submission, I don't remember now. In any event, will fix. > > + for (grub_size_t i =3D 0; i < grub_strlen (cmdline); i++) =20 >=20 > Is cmdline always NUL terminated? Should not we impose a (sensible) > command line length limit in the GRUB code? If GRUB is started in a PVH VM, `grub_xen_setup_pvh` will check the command line to ensure it is NUL-terminated before loading it into the `grub_xen_start_page_addr->cmd_line`. In a PV VM, this struct is populated by Xen itself and GRUB simply grabs a pointer to it that Xen passes it, so I guess in theory a Xen bug could result in this command line not being NUL-terminated. That would be a pretty severe bug on Xen's part, but I suppose it would be good to double-check just in case. > > + { > > + current_char =3D cmdline[i]; > > + > > + if (parse_flags & PARSER_HIT_BACKSLASH) > > + { > > + parse_flags ^=3D PARSER_HIT_BACKSLASH; > > + if (!append_char_to_word (false)) > > + { > > + goto cleanup; > > + } =20 >=20 > Please reduce curly braces to the minimum required... > > > + continue; > > + } > > + > > + if (current_char =3D=3D '\\') =20 >=20 > I think parser code should have comments with explanations why we > treat characters in a given way... >=20 > > + { > > + parse_flags ^=3D PARSER_HIT_BACKSLASH; > > + continue; > > + } > > + > > + if (current_char =3D=3D '\'') =20 >=20 > Would not switch/case be better here? Yes, looking at it now I agree it would be. > > + { > > + if (parse_flags & PARSER_IN_DOUBLE_QUOTES) > > + { > > + if (!append_char_to_word (false)) > > + { > > + goto cleanup; > > + } > > + continue; > > + } > > + > > + parse_flags ^=3D PARSER_IN_SINGLE_QUOTES; > > + continue; > > + } > > + > > + if (current_char =3D=3D '"') =20 >=20 > Ditto and below/everywhere here... >=20 > > + { > > + if (parse_flags & PARSER_IN_SINGLE_QUOTES) > > + { > > + if (!append_char_to_word (false)) > > + { > > + goto cleanup; > > + } > > + continue; > > + } > > + > > + parse_flags ^=3D PARSER_IN_DOUBLE_QUOTES; > > + continue; > > + } > > + > > + if (current_char =3D=3D ' ') > > + { > > + if (parse_flags & PARSER_IN_SINGLE_QUOTES > > + || parse_flags & PARSER_IN_DOUBLE_QUOTES) > > + { > > + if (!append_char_to_word (false)) > > + { > > + goto cleanup; > > + } > > + continue; > > + } > > + > > + append_word_to_list (); > > + continue; > > + } > > + > > + if (!append_char_to_word (false)) > > + { > > + goto cleanup; > > + } > > + } > > + > > + if (current_word_pos > 0) > > + { > > + append_word_to_list (); > > + } > > + > > + param_keys =3D grub_realloc (param_keys, word_list_len * sizeof > > (char *)); > > + param_vals =3D grub_realloc (param_vals, word_list_len * sizeof > > (char *)); =20 >=20 > Again, missing error checks. This kind of code has to be fixed > everywhere. >=20 > > + for (grub_size_t i =3D 0; i < word_list_len; i++) > > + { > > + current_word =3D word_list[i]; > > + current_word_len =3D grub_strlen (current_word) + 1; > > + char *current_word_eq_ptr =3D grub_strchr (current_word, '=3D'); > > =20 >=20 > Missing empty line. >=20 > > + if (current_word_eq_ptr) > > + { > > + grub_size_t eq_idx > > + =3D (grub_size_t)(current_word_eq_ptr - current_word); > > + grub_size_t pre_eq_len > > + =3D current_word_len - (current_word_len - eq_idx); =20 >=20 > I am OK with lines (a bit) longer than 80 characters. >=20 > > + grub_size_t post_eq_len =3D current_word_len - eq_idx - 1; > > + if (check_key_is_safe (current_word, pre_eq_len)) > > + { > > + param_keys[param_dict_len] =3D grub_malloc (pre_eq_len > > + 1); > > + param_vals[param_dict_len] =3D grub_malloc > > (post_eq_len + 1); > > + grub_strncpy (param_keys[param_dict_len], > > + current_word, pre_eq_len); > > + grub_strncpy (param_vals[param_dict_len], > > + current_word + pre_eq_len + 1, > > post_eq_len); > > + param_keys[param_dict_len][pre_eq_len] =3D '\0'; > > + param_vals[param_dict_len][post_eq_len] =3D '\0'; > > + param_dict_len++; > > + } > > + } > > + else > > + { > > + if (check_key_is_safe (current_word, current_word_len - > > 1)) > > + { > > + param_keys[param_dict_len] =3D grub_malloc > > (current_word_len + 1); > > + param_vals[param_dict_len] =3D grub_malloc (2); > > + grub_strncpy (param_keys[param_dict_len], > > + current_word, current_word_len); > > + param_keys[param_dict_len][current_word_len] =3D '\0'; > > + grub_strcpy (param_vals[param_dict_len], "1\0"); > > + param_dict_len++; > > + } > > + } > > + } > > + > > + for (grub_size_t i =3D 0; i < param_dict_len; i++) > > + { > > + /* > > + * Find keys that start with "xen_grub_env_" and export them > > + * as environment variables. > > + */ > > + if (grub_strlen (param_keys[i]) < (sizeof ("xen_grub_env_") > > - 1)) > > + { > > + continue; > > + } > > + if (grub_strncmp (param_keys[i], > > + "xen_grub_env_", > > + sizeof ("xen_grub_env_") - 1) !=3D 0) > > + { > > + continue; > > + } > > + grub_env_set (param_keys[i], param_vals[i]); > > + grub_env_export (param_keys[i]); > > + grub_free (param_keys[i]); > > + grub_free (param_vals[i]); > > + } > > + > > +cleanup: =20 >=20 > Missing space before label. >=20 > Daniel --Sig_/YobrJK5YYpWbvtioCb4wAUl Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEudh48PFXwyPDa0wGpwkWDXPHkQkFAmg3M6AACgkQpwkWDXPH kQlB2w//WKRpjjoRsPqn/Vtf38rTQEwJPadS4WVNHXWK8T93NquevaqaWwttkqRk paFINJrzAbtFMzPk3JGy/KtginHZ9dX/FWOnYGt47XQHqC35XAfOtnzd1U0GLIqY mBdXP941W92UECClHSpOeZ6dApJtAxBRakre3g3JYXdUYPW7/3uFeRZaEDIC2VUf BlD3njvM3o4oIQpCJcNr0gtQM25vORLBLpLh5tIyK32TFc2bfimdZJT0pxqdKdUE EA3NgAu5uJ51FCKWmjOhilbNvTmNujW1oDdiY0s6CuIT9c7VhfaG4KZDjlIM+xZi /ueZ0ys0Po9d1qNHVEYlXK2389M5f9Fqiymy6oiDbXXfYEUv0x28cxHzztt7ly0F n5QBLwV2rt14CcLQgpDC7fxsnE2iL/HWuefZWZmpI7Jw1IuymcyLJY7Md7yQQcWa tFI6nanlpaEGCUnGuOd2ylIr7X6LtbyVuK03NDjHAgJcDBXL7mh5M4hHfCi1I5M7 hQM2BHCOylPyRD+cYbFZm3IUjq0xL9hRd4Y9Y3KOOC2+3uo9MZmKSh2mWfxGcTE/ P2RvS2dyKy9r4TUXIRASnpAWW2xRtR2YTKUYBtLXNxi5R98Jj97KF4aGfBwsHIKx 1um7ST8u+OOZoMHqPw6It4Hzj230BWNACBP0B+D5oRBTORWguaQ= =HUr4 -----END PGP SIGNATURE----- --Sig_/YobrJK5YYpWbvtioCb4wAUl-- --===============2792701298245972105== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KR3J1Yi1kZXZl bCBtYWlsaW5nIGxpc3QKR3J1Yi1kZXZlbEBnbnUub3JnCmh0dHBzOi8vbGlzdHMuZ251Lm9yZy9t YWlsbWFuL2xpc3RpbmZvL2dydWItZGV2ZWwK --===============2792701298245972105==--