Skip to content

Commit 324c92e

Browse files
committed
Merge tag 'efi-urgent-2021-06-02' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull EFI fixes from Ingo Molnar: "A handful of EFI fixes: - Fix/robustify a diagnostic printk - Fix a (normally not triggered) parser bug in the libstub code - Allow !EFI_MEMORY_XP && !EFI_MEMORY_RO entries in the memory map - Stop RISC-V from crashing on boot if there's no FDT table" * tag 'efi-urgent-2021-06-02' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: efi: cper: fix snprintf() use in cper_dimm_err_location() efi/libstub: prevent read overflow in find_file_option() efi: Allow EFI_MEMORY_XP and EFI_MEMORY_RO both to be cleared efi/fdt: fix panic when no valid fdt found
2 parents 0372b6d + e169fba commit 324c92e

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

drivers/firmware/efi/cper.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,7 @@ static int cper_dimm_err_location(struct cper_mem_err_compact *mem, char *msg)
276276
if (!msg || !(mem->validation_bits & CPER_MEM_VALID_MODULE_HANDLE))
277277
return 0;
278278

279-
n = 0;
280-
len = CPER_REC_LEN - 1;
279+
len = CPER_REC_LEN;
281280
dmi_memdev_name(mem->mem_dev_handle, &bank, &device);
282281
if (bank && device)
283282
n = snprintf(msg, len, "DIMM location: %s %s ", bank, device);
@@ -286,7 +285,6 @@ static int cper_dimm_err_location(struct cper_mem_err_compact *mem, char *msg)
286285
"DIMM location: not present. DMI handle: 0x%.4x ",
287286
mem->mem_dev_handle);
288287

289-
msg[n] = '\0';
290288
return n;
291289
}
292290

drivers/firmware/efi/fdtparams.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ u64 __init efi_get_fdt_params(struct efi_memory_map_data *mm)
9898
BUILD_BUG_ON(ARRAY_SIZE(target) != ARRAY_SIZE(name));
9999
BUILD_BUG_ON(ARRAY_SIZE(target) != ARRAY_SIZE(dt_params[0].params));
100100

101+
if (!fdt)
102+
return 0;
103+
101104
for (i = 0; i < ARRAY_SIZE(dt_params); i++) {
102105
node = fdt_path_offset(fdt, dt_params[i].path);
103106
if (node < 0)

drivers/firmware/efi/libstub/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static int find_file_option(const efi_char16_t *cmdline, int cmdline_len,
103103
return 0;
104104

105105
/* Skip any leading slashes */
106-
while (cmdline[i] == L'/' || cmdline[i] == L'\\')
106+
while (i < cmdline_len && (cmdline[i] == L'/' || cmdline[i] == L'\\'))
107107
i++;
108108

109109
while (--result_len > 0 && i < cmdline_len) {

drivers/firmware/efi/memattr.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@ static bool entry_is_valid(const efi_memory_desc_t *in, efi_memory_desc_t *out)
6767
return false;
6868
}
6969

70-
if (!(in->attribute & (EFI_MEMORY_RO | EFI_MEMORY_XP))) {
71-
pr_warn("Entry attributes invalid: RO and XP bits both cleared\n");
72-
return false;
73-
}
74-
7570
if (PAGE_SIZE > EFI_PAGE_SIZE &&
7671
(!PAGE_ALIGNED(in->phys_addr) ||
7772
!PAGE_ALIGNED(in->num_pages << EFI_PAGE_SHIFT))) {

0 commit comments

Comments
 (0)