diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig.debug | 13 | ||||
-rw-r--r-- | lib/div64.c | 2 | ||||
-rw-r--r-- | lib/kobject.c | 7 | ||||
-rw-r--r-- | lib/lcm.c | 11 | ||||
-rw-r--r-- | lib/lockref.c | 2 | ||||
-rw-r--r-- | lib/lz4/lz4_decompress.c | 18 | ||||
-rw-r--r-- | lib/nlattr.c | 2 |
7 files changed, 41 insertions, 14 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 1ad74c0df01f..93967e634a1e 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -865,6 +865,19 @@ config SCHED_STACK_END_CHECK | |||
865 | data corruption or a sporadic crash at a later stage once the region | 865 | data corruption or a sporadic crash at a later stage once the region |
866 | is examined. The runtime overhead introduced is minimal. | 866 | is examined. The runtime overhead introduced is minimal. |
867 | 867 | ||
868 | config DEBUG_TIMEKEEPING | ||
869 | bool "Enable extra timekeeping sanity checking" | ||
870 | help | ||
871 | This option will enable additional timekeeping sanity checks | ||
872 | which may be helpful when diagnosing issues where timekeeping | ||
873 | problems are suspected. | ||
874 | |||
875 | This may include checks in the timekeeping hotpaths, so this | ||
876 | option may have a (very small) performance impact to some | ||
877 | workloads. | ||
878 | |||
879 | If unsure, say N. | ||
880 | |||
868 | config TIMER_STATS | 881 | config TIMER_STATS |
869 | bool "Collect kernel timers statistics" | 882 | bool "Collect kernel timers statistics" |
870 | depends on DEBUG_KERNEL && PROC_FS | 883 | depends on DEBUG_KERNEL && PROC_FS |
diff --git a/lib/div64.c b/lib/div64.c index 4382ad77777e..19ea7ed4b948 100644 --- a/lib/div64.c +++ b/lib/div64.c | |||
@@ -127,7 +127,7 @@ EXPORT_SYMBOL(div64_u64_rem); | |||
127 | * by the book 'Hacker's Delight'. The original source and full proof | 127 | * by the book 'Hacker's Delight'. The original source and full proof |
128 | * can be found here and is available for use without restriction. | 128 | * can be found here and is available for use without restriction. |
129 | * | 129 | * |
130 | * 'http://www.hackersdelight.org/HDcode/newCode/divDouble.c.txt' | 130 | * 'http://www.hackersdelight.org/hdcodetxt/divDouble.c.txt' |
131 | */ | 131 | */ |
132 | #ifndef div64_u64 | 132 | #ifndef div64_u64 |
133 | u64 div64_u64(u64 dividend, u64 divisor) | 133 | u64 div64_u64(u64 dividend, u64 divisor) |
diff --git a/lib/kobject.c b/lib/kobject.c index 03d4ab349fa7..3b841b97fccd 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -576,8 +576,13 @@ void kobject_del(struct kobject *kobj) | |||
576 | */ | 576 | */ |
577 | struct kobject *kobject_get(struct kobject *kobj) | 577 | struct kobject *kobject_get(struct kobject *kobj) |
578 | { | 578 | { |
579 | if (kobj) | 579 | if (kobj) { |
580 | if (!kobj->state_initialized) | ||
581 | WARN(1, KERN_WARNING "kobject: '%s' (%p): is not " | ||
582 | "initialized, yet kobject_get() is being " | ||
583 | "called.\n", kobject_name(kobj), kobj); | ||
580 | kref_get(&kobj->kref); | 584 | kref_get(&kobj->kref); |
585 | } | ||
581 | return kobj; | 586 | return kobj; |
582 | } | 587 | } |
583 | 588 | ||
@@ -12,3 +12,14 @@ unsigned long lcm(unsigned long a, unsigned long b) | |||
12 | return 0; | 12 | return 0; |
13 | } | 13 | } |
14 | EXPORT_SYMBOL_GPL(lcm); | 14 | EXPORT_SYMBOL_GPL(lcm); |
15 | |||
16 | unsigned long lcm_not_zero(unsigned long a, unsigned long b) | ||
17 | { | ||
18 | unsigned long l = lcm(a, b); | ||
19 | |||
20 | if (l) | ||
21 | return l; | ||
22 | |||
23 | return (b ? : a); | ||
24 | } | ||
25 | EXPORT_SYMBOL_GPL(lcm_not_zero); | ||
diff --git a/lib/lockref.c b/lib/lockref.c index ecb9a665ec19..494994bf17c8 100644 --- a/lib/lockref.c +++ b/lib/lockref.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #define CMPXCHG_LOOP(CODE, SUCCESS) do { \ | 18 | #define CMPXCHG_LOOP(CODE, SUCCESS) do { \ |
19 | struct lockref old; \ | 19 | struct lockref old; \ |
20 | BUILD_BUG_ON(sizeof(old) != 8); \ | 20 | BUILD_BUG_ON(sizeof(old) != 8); \ |
21 | old.lock_count = ACCESS_ONCE(lockref->lock_count); \ | 21 | old.lock_count = READ_ONCE(lockref->lock_count); \ |
22 | while (likely(arch_spin_value_unlocked(old.lock.rlock.raw_lock))) { \ | 22 | while (likely(arch_spin_value_unlocked(old.lock.rlock.raw_lock))) { \ |
23 | struct lockref new = old, prev = old; \ | 23 | struct lockref new = old, prev = old; \ |
24 | CODE \ | 24 | CODE \ |
diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c index f0f5c5c3de12..26cc6029b280 100644 --- a/lib/lz4/lz4_decompress.c +++ b/lib/lz4/lz4_decompress.c | |||
@@ -47,6 +47,11 @@ | |||
47 | 47 | ||
48 | #include "lz4defs.h" | 48 | #include "lz4defs.h" |
49 | 49 | ||
50 | static const int dec32table[] = {0, 3, 2, 3, 0, 0, 0, 0}; | ||
51 | #if LZ4_ARCH64 | ||
52 | static const int dec64table[] = {0, 0, 0, -1, 0, 1, 2, 3}; | ||
53 | #endif | ||
54 | |||
50 | static int lz4_uncompress(const char *source, char *dest, int osize) | 55 | static int lz4_uncompress(const char *source, char *dest, int osize) |
51 | { | 56 | { |
52 | const BYTE *ip = (const BYTE *) source; | 57 | const BYTE *ip = (const BYTE *) source; |
@@ -56,10 +61,6 @@ static int lz4_uncompress(const char *source, char *dest, int osize) | |||
56 | BYTE *cpy; | 61 | BYTE *cpy; |
57 | unsigned token; | 62 | unsigned token; |
58 | size_t length; | 63 | size_t length; |
59 | size_t dec32table[] = {0, 3, 2, 3, 0, 0, 0, 0}; | ||
60 | #if LZ4_ARCH64 | ||
61 | size_t dec64table[] = {0, 0, 0, -1, 0, 1, 2, 3}; | ||
62 | #endif | ||
63 | 64 | ||
64 | while (1) { | 65 | while (1) { |
65 | 66 | ||
@@ -116,7 +117,7 @@ static int lz4_uncompress(const char *source, char *dest, int osize) | |||
116 | /* copy repeated sequence */ | 117 | /* copy repeated sequence */ |
117 | if (unlikely((op - ref) < STEPSIZE)) { | 118 | if (unlikely((op - ref) < STEPSIZE)) { |
118 | #if LZ4_ARCH64 | 119 | #if LZ4_ARCH64 |
119 | size_t dec64 = dec64table[op - ref]; | 120 | int dec64 = dec64table[op - ref]; |
120 | #else | 121 | #else |
121 | const int dec64 = 0; | 122 | const int dec64 = 0; |
122 | #endif | 123 | #endif |
@@ -177,11 +178,6 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | |||
177 | BYTE * const oend = op + maxoutputsize; | 178 | BYTE * const oend = op + maxoutputsize; |
178 | BYTE *cpy; | 179 | BYTE *cpy; |
179 | 180 | ||
180 | size_t dec32table[] = {0, 3, 2, 3, 0, 0, 0, 0}; | ||
181 | #if LZ4_ARCH64 | ||
182 | size_t dec64table[] = {0, 0, 0, -1, 0, 1, 2, 3}; | ||
183 | #endif | ||
184 | |||
185 | /* Main Loop */ | 181 | /* Main Loop */ |
186 | while (ip < iend) { | 182 | while (ip < iend) { |
187 | 183 | ||
@@ -249,7 +245,7 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | |||
249 | /* copy repeated sequence */ | 245 | /* copy repeated sequence */ |
250 | if (unlikely((op - ref) < STEPSIZE)) { | 246 | if (unlikely((op - ref) < STEPSIZE)) { |
251 | #if LZ4_ARCH64 | 247 | #if LZ4_ARCH64 |
252 | size_t dec64 = dec64table[op - ref]; | 248 | int dec64 = dec64table[op - ref]; |
253 | #else | 249 | #else |
254 | const int dec64 = 0; | 250 | const int dec64 = 0; |
255 | #endif | 251 | #endif |
diff --git a/lib/nlattr.c b/lib/nlattr.c index 76a1b59523ab..f5907d23272d 100644 --- a/lib/nlattr.c +++ b/lib/nlattr.c | |||
@@ -279,6 +279,8 @@ int nla_memcpy(void *dest, const struct nlattr *src, int count) | |||
279 | int minlen = min_t(int, count, nla_len(src)); | 279 | int minlen = min_t(int, count, nla_len(src)); |
280 | 280 | ||
281 | memcpy(dest, nla_data(src), minlen); | 281 | memcpy(dest, nla_data(src), minlen); |
282 | if (count > minlen) | ||
283 | memset(dest + minlen, 0, count - minlen); | ||
282 | 284 | ||
283 | return minlen; | 285 | return minlen; |
284 | } | 286 | } |