X Tutup
Skip to content

Commit 92067ab

Browse files
committed
bootspec: normalize oom handling in boot_load_efi_entry_pointers()
OOM should usually be fatal, hence make it so here, too.
1 parent 85e1791 commit 92067ab

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

src/shared/bootspec.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -799,25 +799,22 @@ static int boot_load_efi_entry_pointers(BootConfig *config) {
799799
/* Loads the three "pointers" to boot loader entries from their EFI variables */
800800

801801
r = efi_get_variable_string(EFI_LOADER_VARIABLE(LoaderEntryOneShot), &config->entry_oneshot);
802-
if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA)) {
803-
log_warning_errno(r, "Failed to read EFI variable \"LoaderEntryOneShot\": %m");
804-
if (r == -ENOMEM)
805-
return r;
806-
}
802+
if (r == -ENOMEM)
803+
return log_oom();
804+
if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA))
805+
log_warning_errno(r, "Failed to read EFI variable \"LoaderEntryOneShot\", ignoring: %m");
807806

808807
r = efi_get_variable_string(EFI_LOADER_VARIABLE(LoaderEntryDefault), &config->entry_default);
809-
if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA)) {
810-
log_warning_errno(r, "Failed to read EFI variable \"LoaderEntryDefault\": %m");
811-
if (r == -ENOMEM)
812-
return r;
813-
}
808+
if (r == -ENOMEM)
809+
return log_oom();
810+
if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA))
811+
log_warning_errno(r, "Failed to read EFI variable \"LoaderEntryDefault\", ignoring: %m");
814812

815813
r = efi_get_variable_string(EFI_LOADER_VARIABLE(LoaderEntrySelected), &config->entry_selected);
816-
if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA)) {
817-
log_warning_errno(r, "Failed to read EFI variable \"LoaderEntrySelected\": %m");
818-
if (r == -ENOMEM)
819-
return r;
820-
}
814+
if (r == -ENOMEM)
815+
return log_oom();
816+
if (r < 0 && !IN_SET(r, -ENOENT, -ENODATA))
817+
log_warning_errno(r, "Failed to read EFI variable \"LoaderEntrySelected\", ignoring: %m");
821818

822819
return 1;
823820
}

0 commit comments

Comments
 (0)
X Tutup