diff options
author | Ingo Molnar <mingo@kernel.org> | 2016-02-16 10:46:40 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-02-16 10:46:40 -0500 |
commit | 02a5f765c961ea778e30a8356f32528e65f34942 (patch) | |
tree | 2e8aa46386585d6a9f4744ce3d2207823660a205 | |
parent | 4682c211a80ee93214b72d95f861b0f6e90e5445 (diff) | |
parent | a68075908a37850918ad96b056acc9ac4ce1bd90 (diff) |
Merge tag 'efi-urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi into x86/urgent
Pull EFI bug fixes from Matt Fleming:
* Fix bugs in our code that converts ucs2 strings to utf8 where we
unintentionally drop bits from the original string (Jason Andryuk)
* Add the efi-pstore variables to the variable whitelist so that
users can continue to delete them via efivarfs without needing to
manipulate the immutable flag (Matt Fleming)
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | drivers/firmware/efi/vars.c | 1 | ||||
-rw-r--r-- | lib/ucs2_string.c | 14 |
2 files changed, 8 insertions, 7 deletions
diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c index 50f10bad2604..7f2ea21c730d 100644 --- a/drivers/firmware/efi/vars.c +++ b/drivers/firmware/efi/vars.c | |||
@@ -198,6 +198,7 @@ static const struct variable_validate variable_validate[] = { | |||
198 | { EFI_GLOBAL_VARIABLE_GUID, "OsIndications", NULL }, | 198 | { EFI_GLOBAL_VARIABLE_GUID, "OsIndications", NULL }, |
199 | { EFI_GLOBAL_VARIABLE_GUID, "PlatformLang", validate_ascii_string }, | 199 | { EFI_GLOBAL_VARIABLE_GUID, "PlatformLang", validate_ascii_string }, |
200 | { EFI_GLOBAL_VARIABLE_GUID, "Timeout", validate_uint16 }, | 200 | { EFI_GLOBAL_VARIABLE_GUID, "Timeout", validate_uint16 }, |
201 | { LINUX_EFI_CRASH_GUID, "*", NULL }, | ||
201 | { NULL_GUID, "", NULL }, | 202 | { NULL_GUID, "", NULL }, |
202 | }; | 203 | }; |
203 | 204 | ||
diff --git a/lib/ucs2_string.c b/lib/ucs2_string.c index 17dd74e21ef9..f0b323abb4c6 100644 --- a/lib/ucs2_string.c +++ b/lib/ucs2_string.c | |||
@@ -59,9 +59,9 @@ ucs2_utf8size(const ucs2_char_t *src) | |||
59 | for (i = 0; i < ucs2_strlen(src); i++) { | 59 | for (i = 0; i < ucs2_strlen(src); i++) { |
60 | u16 c = src[i]; | 60 | u16 c = src[i]; |
61 | 61 | ||
62 | if (c > 0x800) | 62 | if (c >= 0x800) |
63 | j += 3; | 63 | j += 3; |
64 | else if (c > 0x80) | 64 | else if (c >= 0x80) |
65 | j += 2; | 65 | j += 2; |
66 | else | 66 | else |
67 | j += 1; | 67 | j += 1; |
@@ -88,19 +88,19 @@ ucs2_as_utf8(u8 *dest, const ucs2_char_t *src, unsigned long maxlength) | |||
88 | for (i = 0; maxlength && i < limit; i++) { | 88 | for (i = 0; maxlength && i < limit; i++) { |
89 | u16 c = src[i]; | 89 | u16 c = src[i]; |
90 | 90 | ||
91 | if (c > 0x800) { | 91 | if (c >= 0x800) { |
92 | if (maxlength < 3) | 92 | if (maxlength < 3) |
93 | break; | 93 | break; |
94 | maxlength -= 3; | 94 | maxlength -= 3; |
95 | dest[j++] = 0xe0 | (c & 0xf000) >> 12; | 95 | dest[j++] = 0xe0 | (c & 0xf000) >> 12; |
96 | dest[j++] = 0x80 | (c & 0x0fc0) >> 8; | 96 | dest[j++] = 0x80 | (c & 0x0fc0) >> 6; |
97 | dest[j++] = 0x80 | (c & 0x003f); | 97 | dest[j++] = 0x80 | (c & 0x003f); |
98 | } else if (c > 0x80) { | 98 | } else if (c >= 0x80) { |
99 | if (maxlength < 2) | 99 | if (maxlength < 2) |
100 | break; | 100 | break; |
101 | maxlength -= 2; | 101 | maxlength -= 2; |
102 | dest[j++] = 0xc0 | (c & 0xfe0) >> 5; | 102 | dest[j++] = 0xc0 | (c & 0x7c0) >> 6; |
103 | dest[j++] = 0x80 | (c & 0x01f); | 103 | dest[j++] = 0x80 | (c & 0x03f); |
104 | } else { | 104 | } else { |
105 | maxlength -= 1; | 105 | maxlength -= 1; |
106 | dest[j++] = c & 0x7f; | 106 | dest[j++] = c & 0x7f; |