aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-14 19:32:31 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-14 19:32:31 -0500
commitd8fe4acc88da8fbbe360b6592c9d0abbb85117dc (patch)
treee3d5edc0ad3541a1daf37b60c5fe67b6fe347d22 /lib
parent3aeb58ab6216d864821e8dafb248e8d77403f3e9 (diff)
parent8d3ef556aba2b5b7d8b7144f7be1814d75ea3cc6 (diff)
Merge branch 'akpm' (patch-bomb from Andrew Morton)
Merge patches from Andrew Morton: - memstick fixes - the rest of MM - various misc bits that were awaiting merges from linux-next into mainline: seq_file, printk, rtc, completions, w1, softirqs, llist, kfifo, hfsplus * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (72 commits) cmdline-parser: fix build hfsplus: Fix undefined __divdi3 in hfsplus_init_header_node() kfifo API type safety kfifo: kfifo_copy_{to,from}_user: fix copied bytes calculation sound/core/memalloc.c: use gen_pool_dma_alloc() to allocate iram buffer llists-move-llist_reverse_order-from-raid5-to-llistc-fix llists: move llist_reverse_order from raid5 to llist.c kernel: fix generic_exec_single indentation kernel-provide-a-__smp_call_function_single-stub-for-config_smp-fix kernel: provide a __smp_call_function_single stub for !CONFIG_SMP kernel: remove CONFIG_USE_GENERIC_SMP_HELPERS revert "softirq: Add support for triggering softirq work on softirqs" drivers/w1/masters/w1-gpio.c: use dev_get_platdata() sched: remove INIT_COMPLETION tree-wide: use reinit_completion instead of INIT_COMPLETION sched: replace INIT_COMPLETION with reinit_completion drivers/rtc/rtc-hid-sensor-time.c: enable HID input processing early drivers/rtc/rtc-hid-sensor-time.c: use dev_get_platdata() vsprintf: ignore %n again seq_file: remove "%n" usage from seq_file users ...
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig7
-rw-r--r--lib/kfifo.c4
-rw-r--r--lib/llist.c22
-rw-r--r--lib/lockref.c2
-rw-r--r--lib/vsprintf.c20
5 files changed, 34 insertions, 21 deletions
diff --git a/lib/Kconfig b/lib/Kconfig
index 75485e163ca3..06dc74200a51 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -51,13 +51,6 @@ config PERCPU_RWSEM
51config ARCH_USE_CMPXCHG_LOCKREF 51config ARCH_USE_CMPXCHG_LOCKREF
52 bool 52 bool
53 53
54config CMPXCHG_LOCKREF
55 def_bool y if ARCH_USE_CMPXCHG_LOCKREF
56 depends on SMP
57 depends on !GENERIC_LOCKBREAK
58 depends on !DEBUG_SPINLOCK
59 depends on !DEBUG_LOCK_ALLOC
60
61config CRC_CCITT 54config CRC_CCITT
62 tristate "CRC-CCITT functions" 55 tristate "CRC-CCITT functions"
63 help 56 help
diff --git a/lib/kfifo.c b/lib/kfifo.c
index 7b7f83027b7b..d79b9d222065 100644
--- a/lib/kfifo.c
+++ b/lib/kfifo.c
@@ -215,7 +215,7 @@ static unsigned long kfifo_copy_from_user(struct __kfifo *fifo,
215 * incrementing the fifo->in index counter 215 * incrementing the fifo->in index counter
216 */ 216 */
217 smp_wmb(); 217 smp_wmb();
218 *copied = len - ret; 218 *copied = len - ret * esize;
219 /* return the number of elements which are not copied */ 219 /* return the number of elements which are not copied */
220 return ret; 220 return ret;
221} 221}
@@ -275,7 +275,7 @@ static unsigned long kfifo_copy_to_user(struct __kfifo *fifo, void __user *to,
275 * incrementing the fifo->out index counter 275 * incrementing the fifo->out index counter
276 */ 276 */
277 smp_wmb(); 277 smp_wmb();
278 *copied = len - ret; 278 *copied = len - ret * esize;
279 /* return the number of elements which are not copied */ 279 /* return the number of elements which are not copied */
280 return ret; 280 return ret;
281} 281}
diff --git a/lib/llist.c b/lib/llist.c
index 4a70d120138c..f76196d07409 100644
--- a/lib/llist.c
+++ b/lib/llist.c
@@ -81,3 +81,25 @@ struct llist_node *llist_del_first(struct llist_head *head)
81 return entry; 81 return entry;
82} 82}
83EXPORT_SYMBOL_GPL(llist_del_first); 83EXPORT_SYMBOL_GPL(llist_del_first);
84
85/**
86 * llist_reverse_order - reverse order of a llist chain
87 * @head: first item of the list to be reversed
88 *
89 * Reverse the order of a chain of llist entries and return the
90 * new first entry.
91 */
92struct llist_node *llist_reverse_order(struct llist_node *head)
93{
94 struct llist_node *new_head = NULL;
95
96 while (head) {
97 struct llist_node *tmp = head;
98 head = head->next;
99 tmp->next = new_head;
100 new_head = tmp;
101 }
102
103 return new_head;
104}
105EXPORT_SYMBOL_GPL(llist_reverse_order);
diff --git a/lib/lockref.c b/lib/lockref.c
index af6e95d0bed6..d2b123f8456b 100644
--- a/lib/lockref.c
+++ b/lib/lockref.c
@@ -1,7 +1,7 @@
1#include <linux/export.h> 1#include <linux/export.h>
2#include <linux/lockref.h> 2#include <linux/lockref.h>
3 3
4#ifdef CONFIG_CMPXCHG_LOCKREF 4#if USE_CMPXCHG_LOCKREF
5 5
6/* 6/*
7 * Allow weakly-ordered memory architectures to provide barrier-less 7 * Allow weakly-ordered memory architectures to provide barrier-less
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 48586ac3a62e..10909c571494 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1712,18 +1712,16 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
1712 break; 1712 break;
1713 1713
1714 case FORMAT_TYPE_NRCHARS: { 1714 case FORMAT_TYPE_NRCHARS: {
1715 u8 qualifier = spec.qualifier; 1715 /*
1716 * Since %n poses a greater security risk than
1717 * utility, ignore %n and skip its argument.
1718 */
1719 void *skip_arg;
1716 1720
1717 if (qualifier == 'l') { 1721 WARN_ONCE(1, "Please remove ignored %%n in '%s'\n",
1718 long *ip = va_arg(args, long *); 1722 old_fmt);
1719 *ip = (str - buf); 1723
1720 } else if (_tolower(qualifier) == 'z') { 1724 skip_arg = va_arg(args, void *);
1721 size_t *ip = va_arg(args, size_t *);
1722 *ip = (str - buf);
1723 } else {
1724 int *ip = va_arg(args, int *);
1725 *ip = (str - buf);
1726 }
1727 break; 1725 break;
1728 } 1726 }
1729 1727