From: Lennart Poettering Date: Wed, 23 Mar 2022 16:15:23 +0000 (+0100) Subject: bootspec: normalize oom handling in boot_load_efi_entry_pointers() X-Git-Tag: v251-rc1~12^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=92067ab672f1fcdfd31dfd41f6bca37e2fcc9e95;p=thirdparty%2Fsystemd.git bootspec: normalize oom handling in boot_load_efi_entry_pointers() OOM should usually be fatal, hence make it so here, too. --- diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index 448d65f7e48..52a1612f3d7 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -799,25 +799,22 @@ static int boot_load_efi_entry_pointers(BootConfig *config) { /* Loads the three "pointers" to boot loader entries from their EFI variables */ r = efi_get_variable_string(EFI_LOADER_VARIABLE(LoaderEntryOneShot), &config->entry_oneshot); - if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA)) { - log_warning_errno(r, "Failed to read EFI variable \"LoaderEntryOneShot\": %m"); - if (r == -ENOMEM) - return r; - } + if (r == -ENOMEM) + return log_oom(); + if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA)) + log_warning_errno(r, "Failed to read EFI variable \"LoaderEntryOneShot\", ignoring: %m"); r = efi_get_variable_string(EFI_LOADER_VARIABLE(LoaderEntryDefault), &config->entry_default); - if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA)) { - log_warning_errno(r, "Failed to read EFI variable \"LoaderEntryDefault\": %m"); - if (r == -ENOMEM) - return r; - } + if (r == -ENOMEM) + return log_oom(); + if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA)) + log_warning_errno(r, "Failed to read EFI variable \"LoaderEntryDefault\", ignoring: %m"); r = efi_get_variable_string(EFI_LOADER_VARIABLE(LoaderEntrySelected), &config->entry_selected); - if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA)) { - log_warning_errno(r, "Failed to read EFI variable \"LoaderEntrySelected\": %m"); - if (r == -ENOMEM) - return r; - } + if (r == -ENOMEM) + return log_oom(); + if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA)) + log_warning_errno(r, "Failed to read EFI variable \"LoaderEntrySelected\", ignoring: %m"); return 1; }