Message ID | 20241011224812.25763-2-jonathan@marek.ca |
---|---|
State | New |
Headers | show |
Series | [1/3] efi/libstub: fix efi_parse_options() ignoring the default command line | expand |
On Sat, 12 Oct 2024 at 00:52, Jonathan Marek <jonathan@marek.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@marek.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 >
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");
efi_convert_cmdline() always sets cmdline_size to at least 1 on success, so both the initialization to 0 and > 0 comparison are unecessary. Signed-off-by: Jonathan Marek <jonathan@marek.ca> --- drivers/firmware/efi/libstub/efi-stub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)