diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig.debug | 29 | ||||
-rw-r--r-- | lib/Makefile | 3 | ||||
-rw-r--r-- | lib/asn1_decoder.c | 2 | ||||
-rw-r--r-- | lib/atomic64_test.c | 13 | ||||
-rw-r--r-- | lib/btree.c | 1 | ||||
-rw-r--r-- | lib/bug.c | 21 | ||||
-rw-r--r-- | lib/crc32.c | 4 | ||||
-rw-r--r-- | lib/debugobjects.c | 19 | ||||
-rw-r--r-- | lib/devres.c | 10 | ||||
-rw-r--r-- | lib/digsig.c | 5 | ||||
-rw-r--r-- | lib/fdt_empty_tree.c | 2 | ||||
-rw-r--r-- | lib/idr.c | 40 | ||||
-rw-r--r-- | lib/kobject_uevent.c | 6 | ||||
-rw-r--r-- | lib/libcrc32c.c | 5 | ||||
-rw-r--r-- | lib/nlattr.c | 17 | ||||
-rw-r--r-- | lib/plist.c | 56 | ||||
-rw-r--r-- | lib/radix-tree.c | 13 | ||||
-rw-r--r-- | lib/string.c | 26 | ||||
-rw-r--r-- | lib/swiotlb.c | 2 | ||||
-rw-r--r-- | lib/textsearch.c | 9 | ||||
-rw-r--r-- | lib/vsprintf.c | 4 | ||||
-rw-r--r-- | lib/xz/Kconfig | 24 | ||||
-rw-r--r-- | lib/xz/xz_dec_lzma2.c | 4 |
23 files changed, 204 insertions, 111 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 819ac51202c0..ccca32264748 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -501,6 +501,16 @@ config DEBUG_VM | |||
501 | 501 | ||
502 | If unsure, say N. | 502 | If unsure, say N. |
503 | 503 | ||
504 | config DEBUG_VM_VMACACHE | ||
505 | bool "Debug VMA caching" | ||
506 | depends on DEBUG_VM | ||
507 | help | ||
508 | Enable this to turn on VMA caching debug information. Doing so | ||
509 | can cause significant overhead, so only enable it in non-production | ||
510 | environments. | ||
511 | |||
512 | If unsure, say N. | ||
513 | |||
504 | config DEBUG_VM_RB | 514 | config DEBUG_VM_RB |
505 | bool "Debug VM red-black trees" | 515 | bool "Debug VM red-black trees" |
506 | depends on DEBUG_VM | 516 | depends on DEBUG_VM |
@@ -575,8 +585,8 @@ config DEBUG_HIGHMEM | |||
575 | bool "Highmem debugging" | 585 | bool "Highmem debugging" |
576 | depends on DEBUG_KERNEL && HIGHMEM | 586 | depends on DEBUG_KERNEL && HIGHMEM |
577 | help | 587 | help |
578 | This options enables addition error checking for high memory systems. | 588 | This option enables additional error checking for high memory |
579 | Disable for production systems. | 589 | systems. Disable for production systems. |
580 | 590 | ||
581 | config HAVE_DEBUG_STACKOVERFLOW | 591 | config HAVE_DEBUG_STACKOVERFLOW |
582 | bool | 592 | bool |
@@ -823,11 +833,6 @@ config DEBUG_RT_MUTEXES | |||
823 | This allows rt mutex semantics violations and rt mutex related | 833 | This allows rt mutex semantics violations and rt mutex related |
824 | deadlocks (lockups) to be detected and reported automatically. | 834 | deadlocks (lockups) to be detected and reported automatically. |
825 | 835 | ||
826 | config DEBUG_PI_LIST | ||
827 | bool | ||
828 | default y | ||
829 | depends on DEBUG_RT_MUTEXES | ||
830 | |||
831 | config RT_MUTEX_TESTER | 836 | config RT_MUTEX_TESTER |
832 | bool "Built-in scriptable tester for rt-mutexes" | 837 | bool "Built-in scriptable tester for rt-mutexes" |
833 | depends on DEBUG_KERNEL && RT_MUTEXES | 838 | depends on DEBUG_KERNEL && RT_MUTEXES |
@@ -1053,6 +1058,16 @@ config DEBUG_LIST | |||
1053 | 1058 | ||
1054 | If unsure, say N. | 1059 | If unsure, say N. |
1055 | 1060 | ||
1061 | config DEBUG_PI_LIST | ||
1062 | bool "Debug priority linked list manipulation" | ||
1063 | depends on DEBUG_KERNEL | ||
1064 | help | ||
1065 | Enable this to turn on extended checks in the priority-ordered | ||
1066 | linked-list (plist) walking routines. This checks the entire | ||
1067 | list multiple times during each manipulation. | ||
1068 | |||
1069 | If unsure, say N. | ||
1070 | |||
1056 | config DEBUG_SG | 1071 | config DEBUG_SG |
1057 | bool "Debug SG table operations" | 1072 | bool "Debug SG table operations" |
1058 | depends on DEBUG_KERNEL | 1073 | depends on DEBUG_KERNEL |
diff --git a/lib/Makefile b/lib/Makefile index 0cd7b68e1382..74a32dc49a93 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -148,7 +148,8 @@ obj-$(CONFIG_GENERIC_NET_UTILS) += net_utils.o | |||
148 | 148 | ||
149 | obj-$(CONFIG_STMP_DEVICE) += stmp_device.o | 149 | obj-$(CONFIG_STMP_DEVICE) += stmp_device.o |
150 | 150 | ||
151 | libfdt_files = fdt.o fdt_ro.o fdt_wip.o fdt_rw.o fdt_sw.o fdt_strerror.o | 151 | libfdt_files = fdt.o fdt_ro.o fdt_wip.o fdt_rw.o fdt_sw.o fdt_strerror.o \ |
152 | fdt_empty_tree.o | ||
152 | $(foreach file, $(libfdt_files), \ | 153 | $(foreach file, $(libfdt_files), \ |
153 | $(eval CFLAGS_$(file) = -I$(src)/../scripts/dtc/libfdt)) | 154 | $(eval CFLAGS_$(file) = -I$(src)/../scripts/dtc/libfdt)) |
154 | lib-$(CONFIG_LIBFDT) += $(libfdt_files) | 155 | lib-$(CONFIG_LIBFDT) += $(libfdt_files) |
diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c index 11b9b01fda6b..1a000bb050f9 100644 --- a/lib/asn1_decoder.c +++ b/lib/asn1_decoder.c | |||
@@ -140,7 +140,7 @@ error: | |||
140 | * @decoder: The decoder definition (produced by asn1_compiler) | 140 | * @decoder: The decoder definition (produced by asn1_compiler) |
141 | * @context: The caller's context (to be passed to the action functions) | 141 | * @context: The caller's context (to be passed to the action functions) |
142 | * @data: The encoded data | 142 | * @data: The encoded data |
143 | * @datasize: The size of the encoded data | 143 | * @datalen: The size of the encoded data |
144 | * | 144 | * |
145 | * Decode BER/DER/CER encoded ASN.1 data according to a bytecode pattern | 145 | * Decode BER/DER/CER encoded ASN.1 data according to a bytecode pattern |
146 | * produced by asn1_compiler. Action functions are called on marked tags to | 146 | * produced by asn1_compiler. Action functions are called on marked tags to |
diff --git a/lib/atomic64_test.c b/lib/atomic64_test.c index 00bca223d1e1..0211d30d8c39 100644 --- a/lib/atomic64_test.c +++ b/lib/atomic64_test.c | |||
@@ -8,6 +8,9 @@ | |||
8 | * the Free Software Foundation; either version 2 of the License, or | 8 | * the Free Software Foundation; either version 2 of the License, or |
9 | * (at your option) any later version. | 9 | * (at your option) any later version. |
10 | */ | 10 | */ |
11 | |||
12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
13 | |||
11 | #include <linux/init.h> | 14 | #include <linux/init.h> |
12 | #include <linux/bug.h> | 15 | #include <linux/bug.h> |
13 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
@@ -146,18 +149,18 @@ static __init int test_atomic64(void) | |||
146 | BUG_ON(v.counter != r); | 149 | BUG_ON(v.counter != r); |
147 | 150 | ||
148 | #ifdef CONFIG_X86 | 151 | #ifdef CONFIG_X86 |
149 | printk(KERN_INFO "atomic64 test passed for %s platform %s CX8 and %s SSE\n", | 152 | pr_info("passed for %s platform %s CX8 and %s SSE\n", |
150 | #ifdef CONFIG_X86_64 | 153 | #ifdef CONFIG_X86_64 |
151 | "x86-64", | 154 | "x86-64", |
152 | #elif defined(CONFIG_X86_CMPXCHG64) | 155 | #elif defined(CONFIG_X86_CMPXCHG64) |
153 | "i586+", | 156 | "i586+", |
154 | #else | 157 | #else |
155 | "i386+", | 158 | "i386+", |
156 | #endif | 159 | #endif |
157 | boot_cpu_has(X86_FEATURE_CX8) ? "with" : "without", | 160 | boot_cpu_has(X86_FEATURE_CX8) ? "with" : "without", |
158 | boot_cpu_has(X86_FEATURE_XMM) ? "with" : "without"); | 161 | boot_cpu_has(X86_FEATURE_XMM) ? "with" : "without"); |
159 | #else | 162 | #else |
160 | printk(KERN_INFO "atomic64 test passed\n"); | 163 | pr_info("passed\n"); |
161 | #endif | 164 | #endif |
162 | 165 | ||
163 | return 0; | 166 | return 0; |
diff --git a/lib/btree.c b/lib/btree.c index f9a484676cb6..4264871ea1a0 100644 --- a/lib/btree.c +++ b/lib/btree.c | |||
@@ -198,6 +198,7 @@ EXPORT_SYMBOL_GPL(btree_init); | |||
198 | 198 | ||
199 | void btree_destroy(struct btree_head *head) | 199 | void btree_destroy(struct btree_head *head) |
200 | { | 200 | { |
201 | mempool_free(head->node, head->mempool); | ||
201 | mempool_destroy(head->mempool); | 202 | mempool_destroy(head->mempool); |
202 | head->mempool = NULL; | 203 | head->mempool = NULL; |
203 | } | 204 | } |
@@ -37,6 +37,9 @@ | |||
37 | 37 | ||
38 | Jeremy Fitzhardinge <jeremy@goop.org> 2006 | 38 | Jeremy Fitzhardinge <jeremy@goop.org> 2006 |
39 | */ | 39 | */ |
40 | |||
41 | #define pr_fmt(fmt) fmt | ||
42 | |||
40 | #include <linux/list.h> | 43 | #include <linux/list.h> |
41 | #include <linux/module.h> | 44 | #include <linux/module.h> |
42 | #include <linux/kernel.h> | 45 | #include <linux/kernel.h> |
@@ -153,15 +156,13 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) | |||
153 | 156 | ||
154 | if (warning) { | 157 | if (warning) { |
155 | /* this is a WARN_ON rather than BUG/BUG_ON */ | 158 | /* this is a WARN_ON rather than BUG/BUG_ON */ |
156 | printk(KERN_WARNING "------------[ cut here ]------------\n"); | 159 | pr_warn("------------[ cut here ]------------\n"); |
157 | 160 | ||
158 | if (file) | 161 | if (file) |
159 | printk(KERN_WARNING "WARNING: at %s:%u\n", | 162 | pr_warn("WARNING: at %s:%u\n", file, line); |
160 | file, line); | ||
161 | else | 163 | else |
162 | printk(KERN_WARNING "WARNING: at %p " | 164 | pr_warn("WARNING: at %p [verbose debug info unavailable]\n", |
163 | "[verbose debug info unavailable]\n", | 165 | (void *)bugaddr); |
164 | (void *)bugaddr); | ||
165 | 166 | ||
166 | print_modules(); | 167 | print_modules(); |
167 | show_regs(regs); | 168 | show_regs(regs); |
@@ -174,12 +175,10 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) | |||
174 | printk(KERN_DEFAULT "------------[ cut here ]------------\n"); | 175 | printk(KERN_DEFAULT "------------[ cut here ]------------\n"); |
175 | 176 | ||
176 | if (file) | 177 | if (file) |
177 | printk(KERN_CRIT "kernel BUG at %s:%u!\n", | 178 | pr_crit("kernel BUG at %s:%u!\n", file, line); |
178 | file, line); | ||
179 | else | 179 | else |
180 | printk(KERN_CRIT "Kernel BUG at %p " | 180 | pr_crit("Kernel BUG at %p [verbose debug info unavailable]\n", |
181 | "[verbose debug info unavailable]\n", | 181 | (void *)bugaddr); |
182 | (void *)bugaddr); | ||
183 | 182 | ||
184 | return BUG_TRAP_TYPE_BUG; | 183 | return BUG_TRAP_TYPE_BUG; |
185 | } | 184 | } |
diff --git a/lib/crc32.c b/lib/crc32.c index 70f00ca5ef1e..21a7b2135af6 100644 --- a/lib/crc32.c +++ b/lib/crc32.c | |||
@@ -33,13 +33,13 @@ | |||
33 | #include "crc32defs.h" | 33 | #include "crc32defs.h" |
34 | 34 | ||
35 | #if CRC_LE_BITS > 8 | 35 | #if CRC_LE_BITS > 8 |
36 | # define tole(x) ((__force u32) __constant_cpu_to_le32(x)) | 36 | # define tole(x) ((__force u32) cpu_to_le32(x)) |
37 | #else | 37 | #else |
38 | # define tole(x) (x) | 38 | # define tole(x) (x) |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | #if CRC_BE_BITS > 8 | 41 | #if CRC_BE_BITS > 8 |
42 | # define tobe(x) ((__force u32) __constant_cpu_to_be32(x)) | 42 | # define tobe(x) ((__force u32) cpu_to_be32(x)) |
43 | #else | 43 | #else |
44 | # define tobe(x) (x) | 44 | # define tobe(x) (x) |
45 | #endif | 45 | #endif |
diff --git a/lib/debugobjects.c b/lib/debugobjects.c index e0731c3db706..547f7f923dbc 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c | |||
@@ -7,6 +7,9 @@ | |||
7 | * | 7 | * |
8 | * For licencing details see kernel-base/COPYING | 8 | * For licencing details see kernel-base/COPYING |
9 | */ | 9 | */ |
10 | |||
11 | #define pr_fmt(fmt) "ODEBUG: " fmt | ||
12 | |||
10 | #include <linux/debugobjects.h> | 13 | #include <linux/debugobjects.h> |
11 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
12 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
@@ -218,7 +221,7 @@ static void debug_objects_oom(void) | |||
218 | unsigned long flags; | 221 | unsigned long flags; |
219 | int i; | 222 | int i; |
220 | 223 | ||
221 | printk(KERN_WARNING "ODEBUG: Out of memory. ODEBUG disabled\n"); | 224 | pr_warn("Out of memory. ODEBUG disabled\n"); |
222 | 225 | ||
223 | for (i = 0; i < ODEBUG_HASH_SIZE; i++, db++) { | 226 | for (i = 0; i < ODEBUG_HASH_SIZE; i++, db++) { |
224 | raw_spin_lock_irqsave(&db->lock, flags); | 227 | raw_spin_lock_irqsave(&db->lock, flags); |
@@ -292,11 +295,9 @@ static void debug_object_is_on_stack(void *addr, int onstack) | |||
292 | 295 | ||
293 | limit++; | 296 | limit++; |
294 | if (is_on_stack) | 297 | if (is_on_stack) |
295 | printk(KERN_WARNING | 298 | pr_warn("object is on stack, but not annotated\n"); |
296 | "ODEBUG: object is on stack, but not annotated\n"); | ||
297 | else | 299 | else |
298 | printk(KERN_WARNING | 300 | pr_warn("object is not on stack, but annotated\n"); |
299 | "ODEBUG: object is not on stack, but annotated\n"); | ||
300 | WARN_ON(1); | 301 | WARN_ON(1); |
301 | } | 302 | } |
302 | 303 | ||
@@ -985,7 +986,7 @@ static void __init debug_objects_selftest(void) | |||
985 | if (check_results(&obj, ODEBUG_STATE_NONE, ++fixups, ++warnings)) | 986 | if (check_results(&obj, ODEBUG_STATE_NONE, ++fixups, ++warnings)) |
986 | goto out; | 987 | goto out; |
987 | #endif | 988 | #endif |
988 | printk(KERN_INFO "ODEBUG: selftest passed\n"); | 989 | pr_info("selftest passed\n"); |
989 | 990 | ||
990 | out: | 991 | out: |
991 | debug_objects_fixups = oldfixups; | 992 | debug_objects_fixups = oldfixups; |
@@ -1060,8 +1061,8 @@ static int __init debug_objects_replace_static_objects(void) | |||
1060 | } | 1061 | } |
1061 | local_irq_enable(); | 1062 | local_irq_enable(); |
1062 | 1063 | ||
1063 | printk(KERN_DEBUG "ODEBUG: %d of %d active objects replaced\n", cnt, | 1064 | pr_debug("%d of %d active objects replaced\n", |
1064 | obj_pool_used); | 1065 | cnt, obj_pool_used); |
1065 | return 0; | 1066 | return 0; |
1066 | free: | 1067 | free: |
1067 | hlist_for_each_entry_safe(obj, tmp, &objects, node) { | 1068 | hlist_for_each_entry_safe(obj, tmp, &objects, node) { |
@@ -1090,7 +1091,7 @@ void __init debug_objects_mem_init(void) | |||
1090 | debug_objects_enabled = 0; | 1091 | debug_objects_enabled = 0; |
1091 | if (obj_cache) | 1092 | if (obj_cache) |
1092 | kmem_cache_destroy(obj_cache); | 1093 | kmem_cache_destroy(obj_cache); |
1093 | printk(KERN_WARNING "ODEBUG: out of memory.\n"); | 1094 | pr_warn("out of memory.\n"); |
1094 | } else | 1095 | } else |
1095 | debug_objects_selftest(); | 1096 | debug_objects_selftest(); |
1096 | } | 1097 | } |
diff --git a/lib/devres.c b/lib/devres.c index 2f16c133fd36..f562bf6ff71d 100644 --- a/lib/devres.c +++ b/lib/devres.c | |||
@@ -157,12 +157,12 @@ EXPORT_SYMBOL(devm_ioremap_resource); | |||
157 | * if (!base) | 157 | * if (!base) |
158 | * return -EADDRNOTAVAIL; | 158 | * return -EADDRNOTAVAIL; |
159 | */ | 159 | */ |
160 | void __iomem *devm_request_and_ioremap(struct device *device, | 160 | void __iomem *devm_request_and_ioremap(struct device *dev, |
161 | struct resource *res) | 161 | struct resource *res) |
162 | { | 162 | { |
163 | void __iomem *dest_ptr; | 163 | void __iomem *dest_ptr; |
164 | 164 | ||
165 | dest_ptr = devm_ioremap_resource(device, res); | 165 | dest_ptr = devm_ioremap_resource(dev, res); |
166 | if (IS_ERR(dest_ptr)) | 166 | if (IS_ERR(dest_ptr)) |
167 | return NULL; | 167 | return NULL; |
168 | 168 | ||
@@ -194,7 +194,7 @@ static int devm_ioport_map_match(struct device *dev, void *res, | |||
194 | * Managed ioport_map(). Map is automatically unmapped on driver | 194 | * Managed ioport_map(). Map is automatically unmapped on driver |
195 | * detach. | 195 | * detach. |
196 | */ | 196 | */ |
197 | void __iomem * devm_ioport_map(struct device *dev, unsigned long port, | 197 | void __iomem *devm_ioport_map(struct device *dev, unsigned long port, |
198 | unsigned int nr) | 198 | unsigned int nr) |
199 | { | 199 | { |
200 | void __iomem **ptr, *addr; | 200 | void __iomem **ptr, *addr; |
@@ -265,7 +265,7 @@ static void pcim_iomap_release(struct device *gendev, void *res) | |||
265 | * be safely called without context and guaranteed to succed once | 265 | * be safely called without context and guaranteed to succed once |
266 | * allocated. | 266 | * allocated. |
267 | */ | 267 | */ |
268 | void __iomem * const * pcim_iomap_table(struct pci_dev *pdev) | 268 | void __iomem * const *pcim_iomap_table(struct pci_dev *pdev) |
269 | { | 269 | { |
270 | struct pcim_iomap_devres *dr, *new_dr; | 270 | struct pcim_iomap_devres *dr, *new_dr; |
271 | 271 | ||
@@ -290,7 +290,7 @@ EXPORT_SYMBOL(pcim_iomap_table); | |||
290 | * Managed pci_iomap(). Map is automatically unmapped on driver | 290 | * Managed pci_iomap(). Map is automatically unmapped on driver |
291 | * detach. | 291 | * detach. |
292 | */ | 292 | */ |
293 | void __iomem * pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen) | 293 | void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen) |
294 | { | 294 | { |
295 | void __iomem **tbl; | 295 | void __iomem **tbl; |
296 | 296 | ||
diff --git a/lib/digsig.c b/lib/digsig.c index 8793aeda30ca..ae05ea393fc8 100644 --- a/lib/digsig.c +++ b/lib/digsig.c | |||
@@ -175,10 +175,11 @@ err1: | |||
175 | * digsig_verify() - digital signature verification with public key | 175 | * digsig_verify() - digital signature verification with public key |
176 | * @keyring: keyring to search key in | 176 | * @keyring: keyring to search key in |
177 | * @sig: digital signature | 177 | * @sig: digital signature |
178 | * @sigen: length of the signature | 178 | * @siglen: length of the signature |
179 | * @data: data | 179 | * @data: data |
180 | * @datalen: length of the data | 180 | * @datalen: length of the data |
181 | * @return: 0 on success, -EINVAL otherwise | 181 | * |
182 | * Returns 0 on success, -EINVAL otherwise | ||
182 | * | 183 | * |
183 | * Verifies data integrity against digital signature. | 184 | * Verifies data integrity against digital signature. |
184 | * Currently only RSA is supported. | 185 | * Currently only RSA is supported. |
diff --git a/lib/fdt_empty_tree.c b/lib/fdt_empty_tree.c new file mode 100644 index 000000000000..5d30c58150ad --- /dev/null +++ b/lib/fdt_empty_tree.c | |||
@@ -0,0 +1,2 @@ | |||
1 | #include <linux/libfdt_env.h> | ||
2 | #include "../scripts/dtc/libfdt/fdt_empty_tree.c" | ||
@@ -18,12 +18,6 @@ | |||
18 | * pointer or what ever, we treat it as a (void *). You can pass this | 18 | * pointer or what ever, we treat it as a (void *). You can pass this |
19 | * id to a user for him to pass back at a later time. You then pass | 19 | * id to a user for him to pass back at a later time. You then pass |
20 | * that id to this code and it returns your pointer. | 20 | * that id to this code and it returns your pointer. |
21 | |||
22 | * You can release ids at any time. When all ids are released, most of | ||
23 | * the memory is returned (we keep MAX_IDR_FREE) in a local pool so we | ||
24 | * don't need to go to the memory "store" during an id allocate, just | ||
25 | * so you don't need to be too concerned about locking and conflicts | ||
26 | * with the slab allocator. | ||
27 | */ | 21 | */ |
28 | 22 | ||
29 | #ifndef TEST // to test in user space... | 23 | #ifndef TEST // to test in user space... |
@@ -151,7 +145,7 @@ static void idr_layer_rcu_free(struct rcu_head *head) | |||
151 | 145 | ||
152 | static inline void free_layer(struct idr *idr, struct idr_layer *p) | 146 | static inline void free_layer(struct idr *idr, struct idr_layer *p) |
153 | { | 147 | { |
154 | if (idr->hint && idr->hint == p) | 148 | if (idr->hint == p) |
155 | RCU_INIT_POINTER(idr->hint, NULL); | 149 | RCU_INIT_POINTER(idr->hint, NULL); |
156 | call_rcu(&p->rcu_head, idr_layer_rcu_free); | 150 | call_rcu(&p->rcu_head, idr_layer_rcu_free); |
157 | } | 151 | } |
@@ -249,7 +243,7 @@ static int sub_alloc(struct idr *idp, int *starting_id, struct idr_layer **pa, | |||
249 | id = (id | ((1 << (IDR_BITS * l)) - 1)) + 1; | 243 | id = (id | ((1 << (IDR_BITS * l)) - 1)) + 1; |
250 | 244 | ||
251 | /* if already at the top layer, we need to grow */ | 245 | /* if already at the top layer, we need to grow */ |
252 | if (id >= 1 << (idp->layers * IDR_BITS)) { | 246 | if (id > idr_max(idp->layers)) { |
253 | *starting_id = id; | 247 | *starting_id = id; |
254 | return -EAGAIN; | 248 | return -EAGAIN; |
255 | } | 249 | } |
@@ -562,6 +556,11 @@ void idr_remove(struct idr *idp, int id) | |||
562 | if (id < 0) | 556 | if (id < 0) |
563 | return; | 557 | return; |
564 | 558 | ||
559 | if (id > idr_max(idp->layers)) { | ||
560 | idr_remove_warning(id); | ||
561 | return; | ||
562 | } | ||
563 | |||
565 | sub_remove(idp, (idp->layers - 1) * IDR_BITS, id); | 564 | sub_remove(idp, (idp->layers - 1) * IDR_BITS, id); |
566 | if (idp->top && idp->top->count == 1 && (idp->layers > 1) && | 565 | if (idp->top && idp->top->count == 1 && (idp->layers > 1) && |
567 | idp->top->ary[0]) { | 566 | idp->top->ary[0]) { |
@@ -579,16 +578,6 @@ void idr_remove(struct idr *idp, int id) | |||
579 | bitmap_clear(to_free->bitmap, 0, IDR_SIZE); | 578 | bitmap_clear(to_free->bitmap, 0, IDR_SIZE); |
580 | free_layer(idp, to_free); | 579 | free_layer(idp, to_free); |
581 | } | 580 | } |
582 | while (idp->id_free_cnt >= MAX_IDR_FREE) { | ||
583 | p = get_from_free_list(idp); | ||
584 | /* | ||
585 | * Note: we don't call the rcu callback here, since the only | ||
586 | * layers that fall into the freelist are those that have been | ||
587 | * preallocated. | ||
588 | */ | ||
589 | kmem_cache_free(idr_layer_cache, p); | ||
590 | } | ||
591 | return; | ||
592 | } | 581 | } |
593 | EXPORT_SYMBOL(idr_remove); | 582 | EXPORT_SYMBOL(idr_remove); |
594 | 583 | ||
@@ -809,14 +798,12 @@ void *idr_replace(struct idr *idp, void *ptr, int id) | |||
809 | 798 | ||
810 | p = idp->top; | 799 | p = idp->top; |
811 | if (!p) | 800 | if (!p) |
812 | return ERR_PTR(-EINVAL); | 801 | return ERR_PTR(-ENOENT); |
813 | |||
814 | n = (p->layer+1) * IDR_BITS; | ||
815 | 802 | ||
816 | if (id >= (1 << n)) | 803 | if (id > idr_max(p->layer + 1)) |
817 | return ERR_PTR(-EINVAL); | 804 | return ERR_PTR(-ENOENT); |
818 | 805 | ||
819 | n -= IDR_BITS; | 806 | n = p->layer * IDR_BITS; |
820 | while ((n > 0) && p) { | 807 | while ((n > 0) && p) { |
821 | p = p->ary[(id >> n) & IDR_MASK]; | 808 | p = p->ary[(id >> n) & IDR_MASK]; |
822 | n -= IDR_BITS; | 809 | n -= IDR_BITS; |
@@ -1027,6 +1014,9 @@ void ida_remove(struct ida *ida, int id) | |||
1027 | int n; | 1014 | int n; |
1028 | struct ida_bitmap *bitmap; | 1015 | struct ida_bitmap *bitmap; |
1029 | 1016 | ||
1017 | if (idr_id > idr_max(ida->idr.layers)) | ||
1018 | goto err; | ||
1019 | |||
1030 | /* clear full bits while looking up the leaf idr_layer */ | 1020 | /* clear full bits while looking up the leaf idr_layer */ |
1031 | while ((shift > 0) && p) { | 1021 | while ((shift > 0) && p) { |
1032 | n = (idr_id >> shift) & IDR_MASK; | 1022 | n = (idr_id >> shift) & IDR_MASK; |
@@ -1042,7 +1032,7 @@ void ida_remove(struct ida *ida, int id) | |||
1042 | __clear_bit(n, p->bitmap); | 1032 | __clear_bit(n, p->bitmap); |
1043 | 1033 | ||
1044 | bitmap = (void *)p->ary[n]; | 1034 | bitmap = (void *)p->ary[n]; |
1045 | if (!test_bit(offset, bitmap->bitmap)) | 1035 | if (!bitmap || !test_bit(offset, bitmap->bitmap)) |
1046 | goto err; | 1036 | goto err; |
1047 | 1037 | ||
1048 | /* update bitmap and remove it if empty */ | 1038 | /* update bitmap and remove it if empty */ |
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index 4e3bd71bd949..9ebf9e20de53 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c | |||
@@ -29,7 +29,9 @@ | |||
29 | 29 | ||
30 | 30 | ||
31 | u64 uevent_seqnum; | 31 | u64 uevent_seqnum; |
32 | #ifdef CONFIG_UEVENT_HELPER | ||
32 | char uevent_helper[UEVENT_HELPER_PATH_LEN] = CONFIG_UEVENT_HELPER_PATH; | 33 | char uevent_helper[UEVENT_HELPER_PATH_LEN] = CONFIG_UEVENT_HELPER_PATH; |
34 | #endif | ||
33 | #ifdef CONFIG_NET | 35 | #ifdef CONFIG_NET |
34 | struct uevent_sock { | 36 | struct uevent_sock { |
35 | struct list_head list; | 37 | struct list_head list; |
@@ -109,6 +111,7 @@ static int kobj_bcast_filter(struct sock *dsk, struct sk_buff *skb, void *data) | |||
109 | } | 111 | } |
110 | #endif | 112 | #endif |
111 | 113 | ||
114 | #ifdef CONFIG_UEVENT_HELPER | ||
112 | static int kobj_usermode_filter(struct kobject *kobj) | 115 | static int kobj_usermode_filter(struct kobject *kobj) |
113 | { | 116 | { |
114 | const struct kobj_ns_type_operations *ops; | 117 | const struct kobj_ns_type_operations *ops; |
@@ -147,6 +150,7 @@ static void cleanup_uevent_env(struct subprocess_info *info) | |||
147 | { | 150 | { |
148 | kfree(info->data); | 151 | kfree(info->data); |
149 | } | 152 | } |
153 | #endif | ||
150 | 154 | ||
151 | /** | 155 | /** |
152 | * kobject_uevent_env - send an uevent with environmental data | 156 | * kobject_uevent_env - send an uevent with environmental data |
@@ -323,6 +327,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, | |||
323 | #endif | 327 | #endif |
324 | mutex_unlock(&uevent_sock_mutex); | 328 | mutex_unlock(&uevent_sock_mutex); |
325 | 329 | ||
330 | #ifdef CONFIG_UEVENT_HELPER | ||
326 | /* call uevent_helper, usually only enabled during early boot */ | 331 | /* call uevent_helper, usually only enabled during early boot */ |
327 | if (uevent_helper[0] && !kobj_usermode_filter(kobj)) { | 332 | if (uevent_helper[0] && !kobj_usermode_filter(kobj)) { |
328 | struct subprocess_info *info; | 333 | struct subprocess_info *info; |
@@ -347,6 +352,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, | |||
347 | env = NULL; /* freed by cleanup_uevent_env */ | 352 | env = NULL; /* freed by cleanup_uevent_env */ |
348 | } | 353 | } |
349 | } | 354 | } |
355 | #endif | ||
350 | 356 | ||
351 | exit: | 357 | exit: |
352 | kfree(devpath); | 358 | kfree(devpath); |
diff --git a/lib/libcrc32c.c b/lib/libcrc32c.c index 244f5480c898..b3131f5cf8a2 100644 --- a/lib/libcrc32c.c +++ b/lib/libcrc32c.c | |||
@@ -62,10 +62,7 @@ EXPORT_SYMBOL(crc32c); | |||
62 | static int __init libcrc32c_mod_init(void) | 62 | static int __init libcrc32c_mod_init(void) |
63 | { | 63 | { |
64 | tfm = crypto_alloc_shash("crc32c", 0, 0); | 64 | tfm = crypto_alloc_shash("crc32c", 0, 0); |
65 | if (IS_ERR(tfm)) | 65 | return PTR_ERR_OR_ZERO(tfm); |
66 | return PTR_ERR(tfm); | ||
67 | |||
68 | return 0; | ||
69 | } | 66 | } |
70 | 67 | ||
71 | static void __exit libcrc32c_mod_fini(void) | 68 | static void __exit libcrc32c_mod_fini(void) |
diff --git a/lib/nlattr.c b/lib/nlattr.c index 10ad042d01be..9c3e85ff0a6c 100644 --- a/lib/nlattr.c +++ b/lib/nlattr.c | |||
@@ -136,6 +136,7 @@ int nla_validate(const struct nlattr *head, int len, int maxtype, | |||
136 | errout: | 136 | errout: |
137 | return err; | 137 | return err; |
138 | } | 138 | } |
139 | EXPORT_SYMBOL(nla_validate); | ||
139 | 140 | ||
140 | /** | 141 | /** |
141 | * nla_policy_len - Determin the max. length of a policy | 142 | * nla_policy_len - Determin the max. length of a policy |
@@ -162,6 +163,7 @@ nla_policy_len(const struct nla_policy *p, int n) | |||
162 | 163 | ||
163 | return len; | 164 | return len; |
164 | } | 165 | } |
166 | EXPORT_SYMBOL(nla_policy_len); | ||
165 | 167 | ||
166 | /** | 168 | /** |
167 | * nla_parse - Parse a stream of attributes into a tb buffer | 169 | * nla_parse - Parse a stream of attributes into a tb buffer |
@@ -208,6 +210,7 @@ int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head, | |||
208 | errout: | 210 | errout: |
209 | return err; | 211 | return err; |
210 | } | 212 | } |
213 | EXPORT_SYMBOL(nla_parse); | ||
211 | 214 | ||
212 | /** | 215 | /** |
213 | * nla_find - Find a specific attribute in a stream of attributes | 216 | * nla_find - Find a specific attribute in a stream of attributes |
@@ -228,6 +231,7 @@ struct nlattr *nla_find(const struct nlattr *head, int len, int attrtype) | |||
228 | 231 | ||
229 | return NULL; | 232 | return NULL; |
230 | } | 233 | } |
234 | EXPORT_SYMBOL(nla_find); | ||
231 | 235 | ||
232 | /** | 236 | /** |
233 | * nla_strlcpy - Copy string attribute payload into a sized buffer | 237 | * nla_strlcpy - Copy string attribute payload into a sized buffer |
@@ -258,6 +262,7 @@ size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize) | |||
258 | 262 | ||
259 | return srclen; | 263 | return srclen; |
260 | } | 264 | } |
265 | EXPORT_SYMBOL(nla_strlcpy); | ||
261 | 266 | ||
262 | /** | 267 | /** |
263 | * nla_memcpy - Copy a netlink attribute into another memory area | 268 | * nla_memcpy - Copy a netlink attribute into another memory area |
@@ -278,6 +283,7 @@ int nla_memcpy(void *dest, const struct nlattr *src, int count) | |||
278 | 283 | ||
279 | return minlen; | 284 | return minlen; |
280 | } | 285 | } |
286 | EXPORT_SYMBOL(nla_memcpy); | ||
281 | 287 | ||
282 | /** | 288 | /** |
283 | * nla_memcmp - Compare an attribute with sized memory area | 289 | * nla_memcmp - Compare an attribute with sized memory area |
@@ -295,6 +301,7 @@ int nla_memcmp(const struct nlattr *nla, const void *data, | |||
295 | 301 | ||
296 | return d; | 302 | return d; |
297 | } | 303 | } |
304 | EXPORT_SYMBOL(nla_memcmp); | ||
298 | 305 | ||
299 | /** | 306 | /** |
300 | * nla_strcmp - Compare a string attribute against a string | 307 | * nla_strcmp - Compare a string attribute against a string |
@@ -317,6 +324,7 @@ int nla_strcmp(const struct nlattr *nla, const char *str) | |||
317 | 324 | ||
318 | return d; | 325 | return d; |
319 | } | 326 | } |
327 | EXPORT_SYMBOL(nla_strcmp); | ||
320 | 328 | ||
321 | #ifdef CONFIG_NET | 329 | #ifdef CONFIG_NET |
322 | /** | 330 | /** |
@@ -502,12 +510,3 @@ int nla_append(struct sk_buff *skb, int attrlen, const void *data) | |||
502 | } | 510 | } |
503 | EXPORT_SYMBOL(nla_append); | 511 | EXPORT_SYMBOL(nla_append); |
504 | #endif | 512 | #endif |
505 | |||
506 | EXPORT_SYMBOL(nla_validate); | ||
507 | EXPORT_SYMBOL(nla_policy_len); | ||
508 | EXPORT_SYMBOL(nla_parse); | ||
509 | EXPORT_SYMBOL(nla_find); | ||
510 | EXPORT_SYMBOL(nla_strlcpy); | ||
511 | EXPORT_SYMBOL(nla_memcpy); | ||
512 | EXPORT_SYMBOL(nla_memcmp); | ||
513 | EXPORT_SYMBOL(nla_strcmp); | ||
diff --git a/lib/plist.c b/lib/plist.c index 1ebc95f7a46f..d408e774b746 100644 --- a/lib/plist.c +++ b/lib/plist.c | |||
@@ -134,6 +134,46 @@ void plist_del(struct plist_node *node, struct plist_head *head) | |||
134 | plist_check_head(head); | 134 | plist_check_head(head); |
135 | } | 135 | } |
136 | 136 | ||
137 | /** | ||
138 | * plist_requeue - Requeue @node at end of same-prio entries. | ||
139 | * | ||
140 | * This is essentially an optimized plist_del() followed by | ||
141 | * plist_add(). It moves an entry already in the plist to | ||
142 | * after any other same-priority entries. | ||
143 | * | ||
144 | * @node: &struct plist_node pointer - entry to be moved | ||
145 | * @head: &struct plist_head pointer - list head | ||
146 | */ | ||
147 | void plist_requeue(struct plist_node *node, struct plist_head *head) | ||
148 | { | ||
149 | struct plist_node *iter; | ||
150 | struct list_head *node_next = &head->node_list; | ||
151 | |||
152 | plist_check_head(head); | ||
153 | BUG_ON(plist_head_empty(head)); | ||
154 | BUG_ON(plist_node_empty(node)); | ||
155 | |||
156 | if (node == plist_last(head)) | ||
157 | return; | ||
158 | |||
159 | iter = plist_next(node); | ||
160 | |||
161 | if (node->prio != iter->prio) | ||
162 | return; | ||
163 | |||
164 | plist_del(node, head); | ||
165 | |||
166 | plist_for_each_continue(iter, head) { | ||
167 | if (node->prio != iter->prio) { | ||
168 | node_next = &iter->node_list; | ||
169 | break; | ||
170 | } | ||
171 | } | ||
172 | list_add_tail(&node->node_list, node_next); | ||
173 | |||
174 | plist_check_head(head); | ||
175 | } | ||
176 | |||
137 | #ifdef CONFIG_DEBUG_PI_LIST | 177 | #ifdef CONFIG_DEBUG_PI_LIST |
138 | #include <linux/sched.h> | 178 | #include <linux/sched.h> |
139 | #include <linux/module.h> | 179 | #include <linux/module.h> |
@@ -170,12 +210,20 @@ static void __init plist_test_check(int nr_expect) | |||
170 | BUG_ON(prio_pos->prio_list.next != &first->prio_list); | 210 | BUG_ON(prio_pos->prio_list.next != &first->prio_list); |
171 | } | 211 | } |
172 | 212 | ||
213 | static void __init plist_test_requeue(struct plist_node *node) | ||
214 | { | ||
215 | plist_requeue(node, &test_head); | ||
216 | |||
217 | if (node != plist_last(&test_head)) | ||
218 | BUG_ON(node->prio == plist_next(node)->prio); | ||
219 | } | ||
220 | |||
173 | static int __init plist_test(void) | 221 | static int __init plist_test(void) |
174 | { | 222 | { |
175 | int nr_expect = 0, i, loop; | 223 | int nr_expect = 0, i, loop; |
176 | unsigned int r = local_clock(); | 224 | unsigned int r = local_clock(); |
177 | 225 | ||
178 | pr_debug("start plist test\n"); | 226 | printk(KERN_DEBUG "start plist test\n"); |
179 | plist_head_init(&test_head); | 227 | plist_head_init(&test_head); |
180 | for (i = 0; i < ARRAY_SIZE(test_node); i++) | 228 | for (i = 0; i < ARRAY_SIZE(test_node); i++) |
181 | plist_node_init(test_node + i, 0); | 229 | plist_node_init(test_node + i, 0); |
@@ -193,6 +241,10 @@ static int __init plist_test(void) | |||
193 | nr_expect--; | 241 | nr_expect--; |
194 | } | 242 | } |
195 | plist_test_check(nr_expect); | 243 | plist_test_check(nr_expect); |
244 | if (!plist_node_empty(test_node + i)) { | ||
245 | plist_test_requeue(test_node + i); | ||
246 | plist_test_check(nr_expect); | ||
247 | } | ||
196 | } | 248 | } |
197 | 249 | ||
198 | for (i = 0; i < ARRAY_SIZE(test_node); i++) { | 250 | for (i = 0; i < ARRAY_SIZE(test_node); i++) { |
@@ -203,7 +255,7 @@ static int __init plist_test(void) | |||
203 | plist_test_check(nr_expect); | 255 | plist_test_check(nr_expect); |
204 | } | 256 | } |
205 | 257 | ||
206 | pr_debug("end plist test\n"); | 258 | printk(KERN_DEBUG "end plist test\n"); |
207 | return 0; | 259 | return 0; |
208 | } | 260 | } |
209 | 261 | ||
diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 9599aa72d7a0..3291a8e37490 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/radix-tree.h> | 27 | #include <linux/radix-tree.h> |
28 | #include <linux/percpu.h> | 28 | #include <linux/percpu.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/kmemleak.h> | ||
30 | #include <linux/notifier.h> | 31 | #include <linux/notifier.h> |
31 | #include <linux/cpu.h> | 32 | #include <linux/cpu.h> |
32 | #include <linux/string.h> | 33 | #include <linux/string.h> |
@@ -194,12 +195,17 @@ radix_tree_node_alloc(struct radix_tree_root *root) | |||
194 | * succeed in getting a node here (and never reach | 195 | * succeed in getting a node here (and never reach |
195 | * kmem_cache_alloc) | 196 | * kmem_cache_alloc) |
196 | */ | 197 | */ |
197 | rtp = &__get_cpu_var(radix_tree_preloads); | 198 | rtp = this_cpu_ptr(&radix_tree_preloads); |
198 | if (rtp->nr) { | 199 | if (rtp->nr) { |
199 | ret = rtp->nodes[rtp->nr - 1]; | 200 | ret = rtp->nodes[rtp->nr - 1]; |
200 | rtp->nodes[rtp->nr - 1] = NULL; | 201 | rtp->nodes[rtp->nr - 1] = NULL; |
201 | rtp->nr--; | 202 | rtp->nr--; |
202 | } | 203 | } |
204 | /* | ||
205 | * Update the allocation stack trace as this is more useful | ||
206 | * for debugging. | ||
207 | */ | ||
208 | kmemleak_update_trace(ret); | ||
203 | } | 209 | } |
204 | if (ret == NULL) | 210 | if (ret == NULL) |
205 | ret = kmem_cache_alloc(radix_tree_node_cachep, gfp_mask); | 211 | ret = kmem_cache_alloc(radix_tree_node_cachep, gfp_mask); |
@@ -250,14 +256,14 @@ static int __radix_tree_preload(gfp_t gfp_mask) | |||
250 | int ret = -ENOMEM; | 256 | int ret = -ENOMEM; |
251 | 257 | ||
252 | preempt_disable(); | 258 | preempt_disable(); |
253 | rtp = &__get_cpu_var(radix_tree_preloads); | 259 | rtp = this_cpu_ptr(&radix_tree_preloads); |
254 | while (rtp->nr < ARRAY_SIZE(rtp->nodes)) { | 260 | while (rtp->nr < ARRAY_SIZE(rtp->nodes)) { |
255 | preempt_enable(); | 261 | preempt_enable(); |
256 | node = kmem_cache_alloc(radix_tree_node_cachep, gfp_mask); | 262 | node = kmem_cache_alloc(radix_tree_node_cachep, gfp_mask); |
257 | if (node == NULL) | 263 | if (node == NULL) |
258 | goto out; | 264 | goto out; |
259 | preempt_disable(); | 265 | preempt_disable(); |
260 | rtp = &__get_cpu_var(radix_tree_preloads); | 266 | rtp = this_cpu_ptr(&radix_tree_preloads); |
261 | if (rtp->nr < ARRAY_SIZE(rtp->nodes)) | 267 | if (rtp->nr < ARRAY_SIZE(rtp->nodes)) |
262 | rtp->nodes[rtp->nr++] = node; | 268 | rtp->nodes[rtp->nr++] = node; |
263 | else | 269 | else |
@@ -1296,7 +1302,6 @@ static inline void radix_tree_shrink(struct radix_tree_root *root) | |||
1296 | /** | 1302 | /** |
1297 | * __radix_tree_delete_node - try to free node after clearing a slot | 1303 | * __radix_tree_delete_node - try to free node after clearing a slot |
1298 | * @root: radix tree root | 1304 | * @root: radix tree root |
1299 | * @index: index key | ||
1300 | * @node: node containing @index | 1305 | * @node: node containing @index |
1301 | * | 1306 | * |
1302 | * After clearing the slot at @index in @node from radix tree | 1307 | * After clearing the slot at @index in @node from radix tree |
diff --git a/lib/string.c b/lib/string.c index 9b1f9062a202..992bf30af759 100644 --- a/lib/string.c +++ b/lib/string.c | |||
@@ -107,7 +107,7 @@ EXPORT_SYMBOL(strcpy); | |||
107 | 107 | ||
108 | #ifndef __HAVE_ARCH_STRNCPY | 108 | #ifndef __HAVE_ARCH_STRNCPY |
109 | /** | 109 | /** |
110 | * strncpy - Copy a length-limited, %NUL-terminated string | 110 | * strncpy - Copy a length-limited, C-string |
111 | * @dest: Where to copy the string to | 111 | * @dest: Where to copy the string to |
112 | * @src: Where to copy the string from | 112 | * @src: Where to copy the string from |
113 | * @count: The maximum number of bytes to copy | 113 | * @count: The maximum number of bytes to copy |
@@ -136,7 +136,7 @@ EXPORT_SYMBOL(strncpy); | |||
136 | 136 | ||
137 | #ifndef __HAVE_ARCH_STRLCPY | 137 | #ifndef __HAVE_ARCH_STRLCPY |
138 | /** | 138 | /** |
139 | * strlcpy - Copy a %NUL terminated string into a sized buffer | 139 | * strlcpy - Copy a C-string into a sized buffer |
140 | * @dest: Where to copy the string to | 140 | * @dest: Where to copy the string to |
141 | * @src: Where to copy the string from | 141 | * @src: Where to copy the string from |
142 | * @size: size of destination buffer | 142 | * @size: size of destination buffer |
@@ -182,7 +182,7 @@ EXPORT_SYMBOL(strcat); | |||
182 | 182 | ||
183 | #ifndef __HAVE_ARCH_STRNCAT | 183 | #ifndef __HAVE_ARCH_STRNCAT |
184 | /** | 184 | /** |
185 | * strncat - Append a length-limited, %NUL-terminated string to another | 185 | * strncat - Append a length-limited, C-string to another |
186 | * @dest: The string to be appended to | 186 | * @dest: The string to be appended to |
187 | * @src: The string to append to it | 187 | * @src: The string to append to it |
188 | * @count: The maximum numbers of bytes to copy | 188 | * @count: The maximum numbers of bytes to copy |
@@ -211,7 +211,7 @@ EXPORT_SYMBOL(strncat); | |||
211 | 211 | ||
212 | #ifndef __HAVE_ARCH_STRLCAT | 212 | #ifndef __HAVE_ARCH_STRLCAT |
213 | /** | 213 | /** |
214 | * strlcat - Append a length-limited, %NUL-terminated string to another | 214 | * strlcat - Append a length-limited, C-string to another |
215 | * @dest: The string to be appended to | 215 | * @dest: The string to be appended to |
216 | * @src: The string to append to it | 216 | * @src: The string to append to it |
217 | * @count: The size of the destination buffer. | 217 | * @count: The size of the destination buffer. |
@@ -301,6 +301,24 @@ char *strchr(const char *s, int c) | |||
301 | EXPORT_SYMBOL(strchr); | 301 | EXPORT_SYMBOL(strchr); |
302 | #endif | 302 | #endif |
303 | 303 | ||
304 | #ifndef __HAVE_ARCH_STRCHRNUL | ||
305 | /** | ||
306 | * strchrnul - Find and return a character in a string, or end of string | ||
307 | * @s: The string to be searched | ||
308 | * @c: The character to search for | ||
309 | * | ||
310 | * Returns pointer to first occurrence of 'c' in s. If c is not found, then | ||
311 | * return a pointer to the null byte at the end of s. | ||
312 | */ | ||
313 | char *strchrnul(const char *s, int c) | ||
314 | { | ||
315 | while (*s && *s != (char)c) | ||
316 | s++; | ||
317 | return (char *)s; | ||
318 | } | ||
319 | EXPORT_SYMBOL(strchrnul); | ||
320 | #endif | ||
321 | |||
304 | #ifndef __HAVE_ARCH_STRRCHR | 322 | #ifndef __HAVE_ARCH_STRRCHR |
305 | /** | 323 | /** |
306 | * strrchr - Find the last occurrence of a character in a string | 324 | * strrchr - Find the last occurrence of a character in a string |
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index b604b831f4d1..649d097853a1 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
@@ -374,7 +374,7 @@ void __init swiotlb_free(void) | |||
374 | io_tlb_nslabs = 0; | 374 | io_tlb_nslabs = 0; |
375 | } | 375 | } |
376 | 376 | ||
377 | static int is_swiotlb_buffer(phys_addr_t paddr) | 377 | int is_swiotlb_buffer(phys_addr_t paddr) |
378 | { | 378 | { |
379 | return paddr >= io_tlb_start && paddr < io_tlb_end; | 379 | return paddr >= io_tlb_start && paddr < io_tlb_end; |
380 | } | 380 | } |
diff --git a/lib/textsearch.c b/lib/textsearch.c index e0cc0146ae62..0c7e9ab2d88f 100644 --- a/lib/textsearch.c +++ b/lib/textsearch.c | |||
@@ -159,6 +159,7 @@ errout: | |||
159 | spin_unlock(&ts_mod_lock); | 159 | spin_unlock(&ts_mod_lock); |
160 | return err; | 160 | return err; |
161 | } | 161 | } |
162 | EXPORT_SYMBOL(textsearch_register); | ||
162 | 163 | ||
163 | /** | 164 | /** |
164 | * textsearch_unregister - unregister a textsearch module | 165 | * textsearch_unregister - unregister a textsearch module |
@@ -190,6 +191,7 @@ out: | |||
190 | spin_unlock(&ts_mod_lock); | 191 | spin_unlock(&ts_mod_lock); |
191 | return err; | 192 | return err; |
192 | } | 193 | } |
194 | EXPORT_SYMBOL(textsearch_unregister); | ||
193 | 195 | ||
194 | struct ts_linear_state | 196 | struct ts_linear_state |
195 | { | 197 | { |
@@ -236,6 +238,7 @@ unsigned int textsearch_find_continuous(struct ts_config *conf, | |||
236 | 238 | ||
237 | return textsearch_find(conf, state); | 239 | return textsearch_find(conf, state); |
238 | } | 240 | } |
241 | EXPORT_SYMBOL(textsearch_find_continuous); | ||
239 | 242 | ||
240 | /** | 243 | /** |
241 | * textsearch_prepare - Prepare a search | 244 | * textsearch_prepare - Prepare a search |
@@ -298,6 +301,7 @@ errout: | |||
298 | 301 | ||
299 | return ERR_PTR(err); | 302 | return ERR_PTR(err); |
300 | } | 303 | } |
304 | EXPORT_SYMBOL(textsearch_prepare); | ||
301 | 305 | ||
302 | /** | 306 | /** |
303 | * textsearch_destroy - destroy a search configuration | 307 | * textsearch_destroy - destroy a search configuration |
@@ -316,9 +320,4 @@ void textsearch_destroy(struct ts_config *conf) | |||
316 | 320 | ||
317 | kfree(conf); | 321 | kfree(conf); |
318 | } | 322 | } |
319 | |||
320 | EXPORT_SYMBOL(textsearch_register); | ||
321 | EXPORT_SYMBOL(textsearch_unregister); | ||
322 | EXPORT_SYMBOL(textsearch_prepare); | ||
323 | EXPORT_SYMBOL(textsearch_find_continuous); | ||
324 | EXPORT_SYMBOL(textsearch_destroy); | 323 | EXPORT_SYMBOL(textsearch_destroy); |
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 0648291cdafe..6fe2c84eb055 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
@@ -2347,7 +2347,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args) | |||
2347 | break; | 2347 | break; |
2348 | 2348 | ||
2349 | base = 10; | 2349 | base = 10; |
2350 | is_sign = 0; | 2350 | is_sign = false; |
2351 | 2351 | ||
2352 | switch (*fmt++) { | 2352 | switch (*fmt++) { |
2353 | case 'c': | 2353 | case 'c': |
@@ -2386,7 +2386,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args) | |||
2386 | case 'i': | 2386 | case 'i': |
2387 | base = 0; | 2387 | base = 0; |
2388 | case 'd': | 2388 | case 'd': |
2389 | is_sign = 1; | 2389 | is_sign = true; |
2390 | case 'u': | 2390 | case 'u': |
2391 | break; | 2391 | break; |
2392 | case '%': | 2392 | case '%': |
diff --git a/lib/xz/Kconfig b/lib/xz/Kconfig index 08837db52d94..12d2d777f36b 100644 --- a/lib/xz/Kconfig +++ b/lib/xz/Kconfig | |||
@@ -9,33 +9,33 @@ config XZ_DEC | |||
9 | if XZ_DEC | 9 | if XZ_DEC |
10 | 10 | ||
11 | config XZ_DEC_X86 | 11 | config XZ_DEC_X86 |
12 | bool "x86 BCJ filter decoder" | 12 | bool "x86 BCJ filter decoder" if EXPERT |
13 | default y if X86 | 13 | default y |
14 | select XZ_DEC_BCJ | 14 | select XZ_DEC_BCJ |
15 | 15 | ||
16 | config XZ_DEC_POWERPC | 16 | config XZ_DEC_POWERPC |
17 | bool "PowerPC BCJ filter decoder" | 17 | bool "PowerPC BCJ filter decoder" if EXPERT |
18 | default y if PPC | 18 | default y |
19 | select XZ_DEC_BCJ | 19 | select XZ_DEC_BCJ |
20 | 20 | ||
21 | config XZ_DEC_IA64 | 21 | config XZ_DEC_IA64 |
22 | bool "IA-64 BCJ filter decoder" | 22 | bool "IA-64 BCJ filter decoder" if EXPERT |
23 | default y if IA64 | 23 | default y |
24 | select XZ_DEC_BCJ | 24 | select XZ_DEC_BCJ |
25 | 25 | ||
26 | config XZ_DEC_ARM | 26 | config XZ_DEC_ARM |
27 | bool "ARM BCJ filter decoder" | 27 | bool "ARM BCJ filter decoder" if EXPERT |
28 | default y if ARM | 28 | default y |
29 | select XZ_DEC_BCJ | 29 | select XZ_DEC_BCJ |
30 | 30 | ||
31 | config XZ_DEC_ARMTHUMB | 31 | config XZ_DEC_ARMTHUMB |
32 | bool "ARM-Thumb BCJ filter decoder" | 32 | bool "ARM-Thumb BCJ filter decoder" if EXPERT |
33 | default y if (ARM && ARM_THUMB) | 33 | default y |
34 | select XZ_DEC_BCJ | 34 | select XZ_DEC_BCJ |
35 | 35 | ||
36 | config XZ_DEC_SPARC | 36 | config XZ_DEC_SPARC |
37 | bool "SPARC BCJ filter decoder" | 37 | bool "SPARC BCJ filter decoder" if EXPERT |
38 | default y if SPARC | 38 | default y |
39 | select XZ_DEC_BCJ | 39 | select XZ_DEC_BCJ |
40 | 40 | ||
41 | endif | 41 | endif |
diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c index a6cdc969ea42..08c3c8049998 100644 --- a/lib/xz/xz_dec_lzma2.c +++ b/lib/xz/xz_dec_lzma2.c | |||
@@ -1043,6 +1043,8 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s, | |||
1043 | 1043 | ||
1044 | s->lzma2.sequence = SEQ_LZMA_PREPARE; | 1044 | s->lzma2.sequence = SEQ_LZMA_PREPARE; |
1045 | 1045 | ||
1046 | /* Fall through */ | ||
1047 | |||
1046 | case SEQ_LZMA_PREPARE: | 1048 | case SEQ_LZMA_PREPARE: |
1047 | if (s->lzma2.compressed < RC_INIT_BYTES) | 1049 | if (s->lzma2.compressed < RC_INIT_BYTES) |
1048 | return XZ_DATA_ERROR; | 1050 | return XZ_DATA_ERROR; |
@@ -1053,6 +1055,8 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s, | |||
1053 | s->lzma2.compressed -= RC_INIT_BYTES; | 1055 | s->lzma2.compressed -= RC_INIT_BYTES; |
1054 | s->lzma2.sequence = SEQ_LZMA_RUN; | 1056 | s->lzma2.sequence = SEQ_LZMA_RUN; |
1055 | 1057 | ||
1058 | /* Fall through */ | ||
1059 | |||
1056 | case SEQ_LZMA_RUN: | 1060 | case SEQ_LZMA_RUN: |
1057 | /* | 1061 | /* |
1058 | * Set dictionary limit to indicate how much we want | 1062 | * Set dictionary limit to indicate how much we want |