Skip to content

Commit a37ca6a

Browse files
nivedita76ardbiesheuvel
authored andcommitted
efi/libstub: Handle NULL cmdline
Treat a NULL cmdline the same as empty. Although this is unlikely to happen in practice, the x86 kernel entry does check for NULL cmdline and handles it, so do it here as well. Cc: <[email protected]> Signed-off-by: Arvind Sankar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent 1fd9717 commit a37ca6a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/firmware/efi/libstub/efi-stub-helper.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,14 @@ int efi_printk(const char *fmt, ...)
187187
*/
188188
efi_status_t efi_parse_options(char const *cmdline)
189189
{
190-
size_t len = strlen(cmdline) + 1;
190+
size_t len;
191191
efi_status_t status;
192192
char *str, *buf;
193193

194+
if (!cmdline)
195+
return EFI_SUCCESS;
196+
197+
len = strlen(cmdline) + 1;
194198
status = efi_bs_call(allocate_pool, EFI_LOADER_DATA, len, (void **)&buf);
195199
if (status != EFI_SUCCESS)
196200
return status;

0 commit comments

Comments
 (0)