aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/kobject_uevent.c2
-rw-r--r--lib/lzo/lzo1x_decompress.c2
-rw-r--r--lib/random32.c13
3 files changed, 11 insertions, 6 deletions
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 5a402e2982af..5b6d7f6956b9 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -55,7 +55,7 @@ int kobject_action_type(const char *buf, size_t count,
55 enum kobject_action action; 55 enum kobject_action action;
56 int ret = -EINVAL; 56 int ret = -EINVAL;
57 57
58 if (count && buf[count-1] == '\n') 58 if (count && (buf[count-1] == '\n' || buf[count-1] == '\0'))
59 count--; 59 count--;
60 60
61 if (!count) 61 if (!count)
diff --git a/lib/lzo/lzo1x_decompress.c b/lib/lzo/lzo1x_decompress.c
index 9dc7056e5520..77f0f9b775a9 100644
--- a/lib/lzo/lzo1x_decompress.c
+++ b/lib/lzo/lzo1x_decompress.c
@@ -158,7 +158,7 @@ match:
158 t += 7 + *ip++; 158 t += 7 + *ip++;
159 } 159 }
160 m_pos -= le16_to_cpu(get_unaligned( 160 m_pos -= le16_to_cpu(get_unaligned(
161 (const unsigned short *)ip) >> 2); 161 (const unsigned short *)ip)) >> 2;
162 ip += 2; 162 ip += 2;
163 if (m_pos == op) 163 if (m_pos == op)
164 goto eof_found; 164 goto eof_found;
diff --git a/lib/random32.c b/lib/random32.c
index ec7f81d3fb18..ca87d86992bd 100644
--- a/lib/random32.c
+++ b/lib/random32.c
@@ -97,13 +97,18 @@ EXPORT_SYMBOL(random32);
97 * @seed: seed value 97 * @seed: seed value
98 * 98 *
99 * Add some additional seeding to the random32() pool. 99 * Add some additional seeding to the random32() pool.
100 * Note: this pool is per cpu so it only affects current CPU.
101 */ 100 */
102void srandom32(u32 entropy) 101void srandom32(u32 entropy)
103{ 102{
104 struct rnd_state *state = &get_cpu_var(net_rand_state); 103 int i;
105 __set_random32(state, state->s1 ^ entropy); 104 /*
106 put_cpu_var(state); 105 * No locking on the CPUs, but then somewhat random results are, well,
106 * expected.
107 */
108 for_each_possible_cpu (i) {
109 struct rnd_state *state = &per_cpu(net_rand_state, i);
110 __set_random32(state, state->s1 ^ entropy);
111 }
107} 112}
108EXPORT_SYMBOL(srandom32); 113EXPORT_SYMBOL(srandom32);
109 114