[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMj1kXFK_4KGtyeyfRvhV1KtbQgE6sHiDWpOzq=xZKb34mn4ow@mail.gmail.com>
Date: Sat, 12 Oct 2024 09:49:39 +0200
From: Ard Biesheuvel <ardb@...nel.org>
To: Jonathan Marek <jonathan@...ek.ca>
Cc: linux-efi@...r.kernel.org,
Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/3] efi/libstub: remove uneccessary cmdline_size init/check
On Sat, 12 Oct 2024 at 00:52, Jonathan Marek <jonathan@...ek.ca> wrote:
>
> efi_convert_cmdline() always sets cmdline_size to at least 1 on success,
> so both the initialization to 0 and > 0 comparison are unecessary.
>
The intent is to avoid parsing the empty string, so arguably, we
should test for cmdline_size > 1 instead. But if we fix
efi_convert_cmdline() instead, as I proposed in reply to 1/3, I guess
we can drop this patch.
> Signed-off-by: Jonathan Marek <jonathan@...ek.ca>
> ---
> drivers/firmware/efi/libstub/efi-stub.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi/libstub/efi-stub.c
> index 709ae2d41a632..f166614ef8432 100644
> --- a/drivers/firmware/efi/libstub/efi-stub.c
> +++ b/drivers/firmware/efi/libstub/efi-stub.c
> @@ -112,7 +112,7 @@ static u32 get_supported_rt_services(void)
>
> efi_status_t efi_handle_cmdline(efi_loaded_image_t *image, char **cmdline_ptr)
> {
> - int cmdline_size = 0;
> + int cmdline_size;
> efi_status_t status;
> char *cmdline;
>
> @@ -137,7 +137,7 @@ efi_status_t efi_handle_cmdline(efi_loaded_image_t *image, char **cmdline_ptr)
> }
> }
>
> - if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && cmdline_size > 0) {
> + if (!IS_ENABLED(CONFIG_CMDLINE_FORCE)) {
> status = efi_parse_options(cmdline);
> if (status != EFI_SUCCESS) {
> efi_err("Failed to parse options\n");
> --
> 2.45.1
>
Powered by blists - more mailing lists