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: <stable@vger.kernel.org> Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu> Link: https://lore.kernel.org/r/20200729193300.598448-1-nivedita@alum.mit.edu Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent 1fd9717 commit a37ca6a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

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)