diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig.debug | 2 | ||||
-rw-r--r-- | lib/Makefile | 2 | ||||
-rw-r--r-- | lib/dma-debug.c | 2 | ||||
-rw-r--r-- | lib/lcm.c | 15 | ||||
-rw-r--r-- | lib/radix-tree.c | 12 | ||||
-rw-r--r-- | lib/vsprintf.c | 10 |
6 files changed, 29 insertions, 14 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index ff017108700d..935248bdbc47 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -356,7 +356,7 @@ config SLUB_STATS | |||
356 | config DEBUG_KMEMLEAK | 356 | config DEBUG_KMEMLEAK |
357 | bool "Kernel memory leak detector" | 357 | bool "Kernel memory leak detector" |
358 | depends on DEBUG_KERNEL && EXPERIMENTAL && !MEMORY_HOTPLUG && \ | 358 | depends on DEBUG_KERNEL && EXPERIMENTAL && !MEMORY_HOTPLUG && \ |
359 | (X86 || ARM || PPC || S390 || SUPERH || MICROBLAZE) | 359 | (X86 || ARM || PPC || S390 || SPARC64 || SUPERH || MICROBLAZE) |
360 | 360 | ||
361 | select DEBUG_FS if SYSFS | 361 | select DEBUG_FS if SYSFS |
362 | select STACKTRACE if STACKTRACE_SUPPORT | 362 | select STACKTRACE if STACKTRACE_SUPPORT |
diff --git a/lib/Makefile b/lib/Makefile index 2e152aed7198..0d4015205c64 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -21,7 +21,7 @@ lib-y += kobject.o kref.o klist.o | |||
21 | 21 | ||
22 | obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ | 22 | obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ |
23 | bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ | 23 | bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ |
24 | string_helpers.o gcd.o list_sort.o | 24 | string_helpers.o gcd.o lcm.o list_sort.o |
25 | 25 | ||
26 | ifeq ($(CONFIG_DEBUG_KOBJECT),y) | 26 | ifeq ($(CONFIG_DEBUG_KOBJECT),y) |
27 | CFLAGS_kobject.o += -DDEBUG | 27 | CFLAGS_kobject.o += -DDEBUG |
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index ba8b67039d13..01e64270e246 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
@@ -570,7 +570,7 @@ static ssize_t filter_write(struct file *file, const char __user *userbuf, | |||
570 | * Now parse out the first token and use it as the name for the | 570 | * Now parse out the first token and use it as the name for the |
571 | * driver to filter for. | 571 | * driver to filter for. |
572 | */ | 572 | */ |
573 | for (i = 0; i < NAME_MAX_LEN; ++i) { | 573 | for (i = 0; i < NAME_MAX_LEN - 1; ++i) { |
574 | current_driver_name[i] = buf[i]; | 574 | current_driver_name[i] = buf[i]; |
575 | if (isspace(buf[i]) || buf[i] == ' ' || buf[i] == 0) | 575 | if (isspace(buf[i]) || buf[i] == ' ' || buf[i] == 0) |
576 | break; | 576 | break; |
diff --git a/lib/lcm.c b/lib/lcm.c new file mode 100644 index 000000000000..157cd88a6ffc --- /dev/null +++ b/lib/lcm.c | |||
@@ -0,0 +1,15 @@ | |||
1 | #include <linux/kernel.h> | ||
2 | #include <linux/gcd.h> | ||
3 | #include <linux/module.h> | ||
4 | |||
5 | /* Lowest common multiple */ | ||
6 | unsigned long lcm(unsigned long a, unsigned long b) | ||
7 | { | ||
8 | if (a && b) | ||
9 | return (a * b) / gcd(a, b); | ||
10 | else if (b) | ||
11 | return b; | ||
12 | |||
13 | return a; | ||
14 | } | ||
15 | EXPORT_SYMBOL_GPL(lcm); | ||
diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 0871582aa29d..2a087e0f9863 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c | |||
@@ -555,6 +555,10 @@ EXPORT_SYMBOL(radix_tree_tag_clear); | |||
555 | * | 555 | * |
556 | * 0: tag not present or not set | 556 | * 0: tag not present or not set |
557 | * 1: tag set | 557 | * 1: tag set |
558 | * | ||
559 | * Note that the return value of this function may not be relied on, even if | ||
560 | * the RCU lock is held, unless tag modification and node deletion are excluded | ||
561 | * from concurrency. | ||
558 | */ | 562 | */ |
559 | int radix_tree_tag_get(struct radix_tree_root *root, | 563 | int radix_tree_tag_get(struct radix_tree_root *root, |
560 | unsigned long index, unsigned int tag) | 564 | unsigned long index, unsigned int tag) |
@@ -595,12 +599,8 @@ int radix_tree_tag_get(struct radix_tree_root *root, | |||
595 | */ | 599 | */ |
596 | if (!tag_get(node, tag, offset)) | 600 | if (!tag_get(node, tag, offset)) |
597 | saw_unset_tag = 1; | 601 | saw_unset_tag = 1; |
598 | if (height == 1) { | 602 | if (height == 1) |
599 | int ret = tag_get(node, tag, offset); | 603 | return !!tag_get(node, tag, offset); |
600 | |||
601 | BUG_ON(ret && saw_unset_tag); | ||
602 | return !!ret; | ||
603 | } | ||
604 | node = rcu_dereference_raw(node->slots[offset]); | 604 | node = rcu_dereference_raw(node->slots[offset]); |
605 | shift -= RADIX_TREE_MAP_SHIFT; | 605 | shift -= RADIX_TREE_MAP_SHIFT; |
606 | height--; | 606 | height--; |
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 24112e5a5780..7376b7c55ffe 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
@@ -408,12 +408,12 @@ enum format_type { | |||
408 | }; | 408 | }; |
409 | 409 | ||
410 | struct printf_spec { | 410 | struct printf_spec { |
411 | u16 type; | 411 | u8 type; /* format_type enum */ |
412 | s16 field_width; /* width of output field */ | ||
413 | u8 flags; /* flags to number() */ | 412 | u8 flags; /* flags to number() */ |
414 | u8 base; | 413 | u8 base; /* number base, 8, 10 or 16 only */ |
415 | s8 precision; /* # of digits/chars */ | 414 | u8 qualifier; /* number qualifier, one of 'hHlLtzZ' */ |
416 | u8 qualifier; | 415 | s16 field_width; /* width of output field */ |
416 | s16 precision; /* # of digits/chars */ | ||
417 | }; | 417 | }; |
418 | 418 | ||
419 | static char *number(char *buf, char *end, unsigned long long num, | 419 | static char *number(char *buf, char *end, unsigned long long num, |