diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2015-07-26 08:59:00 -0400 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2015-07-27 13:00:05 -0400 |
commit | f91b1feada0b6f0a4d33648155b3ded2c4e0707e (patch) | |
tree | 4108b78d691b26c3dbf69ecc58a82bd6f44ff133 /arch/arm64 | |
parent | cbfe8fa6cd672011c755c3cd85c9ffd4e2d10a6f (diff) |
arm64/efi: map the entire UEFI vendor string before reading it
At boot, the UTF-16 UEFI vendor string is copied from the system
table into a char array with a size of 100 bytes. However, this
size of 100 bytes is also used for memremapping() the source,
which may not be sufficient if the vendor string exceeds 50
UTF-16 characters, and the placement of the vendor string inside
a 4 KB page happens to leave the end unmapped.
So use the correct '100 * sizeof(efi_char16_t)' for the size of
the mapping.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Fixes: f84d02755f5a ("arm64: add EFI runtime services")
Cc: <stable@vger.kernel.org> # 3.16+
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64')
-rw-r--r-- | arch/arm64/kernel/efi.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index 9d4aa18f2a82..e8ca6eaedd02 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c | |||
@@ -122,12 +122,12 @@ static int __init uefi_init(void) | |||
122 | 122 | ||
123 | /* Show what we know for posterity */ | 123 | /* Show what we know for posterity */ |
124 | c16 = early_memremap(efi_to_phys(efi.systab->fw_vendor), | 124 | c16 = early_memremap(efi_to_phys(efi.systab->fw_vendor), |
125 | sizeof(vendor)); | 125 | sizeof(vendor) * sizeof(efi_char16_t)); |
126 | if (c16) { | 126 | if (c16) { |
127 | for (i = 0; i < (int) sizeof(vendor) - 1 && *c16; ++i) | 127 | for (i = 0; i < (int) sizeof(vendor) - 1 && *c16; ++i) |
128 | vendor[i] = c16[i]; | 128 | vendor[i] = c16[i]; |
129 | vendor[i] = '\0'; | 129 | vendor[i] = '\0'; |
130 | early_memunmap(c16, sizeof(vendor)); | 130 | early_memunmap(c16, sizeof(vendor) * sizeof(efi_char16_t)); |
131 | } | 131 | } |
132 | 132 | ||
133 | pr_info("EFI v%u.%.02u by %s\n", | 133 | pr_info("EFI v%u.%.02u by %s\n", |