diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-20 21:38:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-20 21:38:48 -0400 |
commit | db93f8b42036bd60d95e8d28ee98b308d5846b9f (patch) | |
tree | e98018a262346250f9bf8ff68b80132a94fd18ab /lib | |
parent | 8c3a13c84b90f2551b646ff2956ac68bef69a810 (diff) | |
parent | c0a9f451e4e7ecd2ad1a6c27ea5c31d0226bdddf (diff) |
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Peter Anvin:
"Three groups of fixes:
1. Make sure we don't execute the early microcode patching if family
< 6, since it would touch MSRs which don't exist on those
families, causing crashes.
2. The Xen partial emulation of HyperV can be dealt with more
gracefully than just disabling the driver.
3. More EFI variable space magic. In particular, variables hidden
from runtime code need to be taken into account too."
* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86, microcode: Verify the family before dispatching microcode patching
x86, hyperv: Handle Xen emulation of Hyper-V more gracefully
x86,efi: Implement efi_no_storage_paranoia parameter
efi: Export efi_query_variable_store() for efivars.ko
x86/Kconfig: Make EFI select UCS2_STRING
efi: Distinguish between "remaining space" and actually used space
efi: Pass boot services variable info to runtime code
Move utf16 functions to kernel core and rename
x86,efi: Check max_size only if it is non-zero.
x86, efivars: firmware bug workarounds should be in platform code
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig | 3 | ||||
-rw-r--r-- | lib/Makefile | 2 | ||||
-rw-r--r-- | lib/ucs2_string.c | 51 |
3 files changed, 56 insertions, 0 deletions
diff --git a/lib/Kconfig b/lib/Kconfig index 3958dc4389f9..fe01d418b09a 100644 --- a/lib/Kconfig +++ b/lib/Kconfig | |||
@@ -404,4 +404,7 @@ config OID_REGISTRY | |||
404 | help | 404 | help |
405 | Enable fast lookup object identifier registry. | 405 | Enable fast lookup object identifier registry. |
406 | 406 | ||
407 | config UCS2_STRING | ||
408 | tristate | ||
409 | |||
407 | endmenu | 410 | endmenu |
diff --git a/lib/Makefile b/lib/Makefile index d7946ff75b2e..6e2cc561f761 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -174,3 +174,5 @@ quiet_cmd_build_OID_registry = GEN $@ | |||
174 | cmd_build_OID_registry = perl $(srctree)/$(src)/build_OID_registry $< $@ | 174 | cmd_build_OID_registry = perl $(srctree)/$(src)/build_OID_registry $< $@ |
175 | 175 | ||
176 | clean-files += oid_registry_data.c | 176 | clean-files += oid_registry_data.c |
177 | |||
178 | obj-$(CONFIG_UCS2_STRING) += ucs2_string.o | ||
diff --git a/lib/ucs2_string.c b/lib/ucs2_string.c new file mode 100644 index 000000000000..6f500ef2301d --- /dev/null +++ b/lib/ucs2_string.c | |||
@@ -0,0 +1,51 @@ | |||
1 | #include <linux/ucs2_string.h> | ||
2 | #include <linux/module.h> | ||
3 | |||
4 | /* Return the number of unicode characters in data */ | ||
5 | unsigned long | ||
6 | ucs2_strnlen(const ucs2_char_t *s, size_t maxlength) | ||
7 | { | ||
8 | unsigned long length = 0; | ||
9 | |||
10 | while (*s++ != 0 && length < maxlength) | ||
11 | length++; | ||
12 | return length; | ||
13 | } | ||
14 | EXPORT_SYMBOL(ucs2_strnlen); | ||
15 | |||
16 | unsigned long | ||
17 | ucs2_strlen(const ucs2_char_t *s) | ||
18 | { | ||
19 | return ucs2_strnlen(s, ~0UL); | ||
20 | } | ||
21 | EXPORT_SYMBOL(ucs2_strlen); | ||
22 | |||
23 | /* | ||
24 | * Return the number of bytes is the length of this string | ||
25 | * Note: this is NOT the same as the number of unicode characters | ||
26 | */ | ||
27 | unsigned long | ||
28 | ucs2_strsize(const ucs2_char_t *data, unsigned long maxlength) | ||
29 | { | ||
30 | return ucs2_strnlen(data, maxlength/sizeof(ucs2_char_t)) * sizeof(ucs2_char_t); | ||
31 | } | ||
32 | EXPORT_SYMBOL(ucs2_strsize); | ||
33 | |||
34 | int | ||
35 | ucs2_strncmp(const ucs2_char_t *a, const ucs2_char_t *b, size_t len) | ||
36 | { | ||
37 | while (1) { | ||
38 | if (len == 0) | ||
39 | return 0; | ||
40 | if (*a < *b) | ||
41 | return -1; | ||
42 | if (*a > *b) | ||
43 | return 1; | ||
44 | if (*a == 0) /* implies *b == 0 */ | ||
45 | return 0; | ||
46 | a++; | ||
47 | b++; | ||
48 | len--; | ||
49 | } | ||
50 | } | ||
51 | EXPORT_SYMBOL(ucs2_strncmp); | ||