efi/libstub: fix efi_parse_options() ignoring the default command line
authorJonathan Marek <jonathan@marek.ca>
Sun, 13 Oct 2024 05:11:56 +0000 (01:11 -0400)
committerArd Biesheuvel <ardb@kernel.org>
Tue, 15 Oct 2024 18:03:17 +0000 (20:03 +0200)
commitaacfa0ef247b0130b7a98bb52378f8cd727a66ca
treeb4ea79cb0650681e78b01a794402e5a2d2beb752
parent8e929cb546ee42c9a61d24fae60605e9e3192354
efi/libstub: fix efi_parse_options() ignoring the default command line

efi_convert_cmdline() always returns a size of at least 1 because it
counts the NUL terminator, so the "cmdline_size == 0" condition is never
satisfied.

Change it to check if the string starts with a NUL character to get the
intended behavior: to use CONFIG_CMDLINE when load_options_size == 0.

Fixes: 60f38de7a8d4 ("efi/libstub: Unify command line param parsing")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/libstub/efi-stub.c