diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig.debug | 44 | ||||
-rw-r--r-- | lib/Makefile | 4 | ||||
-rw-r--r-- | lib/dynamic_debug.c | 1 | ||||
-rw-r--r-- | lib/hexdump.c | 15 | ||||
-rw-r--r-- | lib/idr.c | 2 | ||||
-rw-r--r-- | lib/sha1.c | 1 | ||||
-rw-r--r-- | lib/xz/xz_dec_bcj.c | 27 |
7 files changed, 57 insertions, 37 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index c0cb9c4bc46..75330bd8756 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -117,31 +117,31 @@ config DEBUG_SECTION_MISMATCH help The section mismatch analysis checks if there are illegal references from one section to another section. - Linux will during link or during runtime drop some sections - and any use of code/data previously in these sections will + During linktime or runtime, some sections are dropped; + any use of code/data previously in these sections would most likely result in an oops. - In the code functions and variables are annotated with - __init, __devinit etc. (see full list in include/linux/init.h) + In the code, functions and variables are annotated with + __init, __devinit, etc. (see the full list in include/linux/init.h), which results in the code/data being placed in specific sections. - The section mismatch analysis is always done after a full - kernel build but enabling this option will in addition - do the following: - - Add the option -fno-inline-functions-called-once to gcc - When inlining a function annotated __init in a non-init - function we would lose the section information and thus + The section mismatch analysis is always performed after a full + kernel build, and enabling this option causes the following + additional steps to occur: + - Add the option -fno-inline-functions-called-once to gcc commands. + When inlining a function annotated with __init in a non-init + function, we would lose the section information and thus the analysis would not catch the illegal reference. - This option tells gcc to inline less but will also - result in a larger kernel. - - Run the section mismatch analysis for each module/built-in.o - When we run the section mismatch analysis on vmlinux.o we + This option tells gcc to inline less (but it does result in + a larger kernel). + - Run the section mismatch analysis for each module/built-in.o file. + When we run the section mismatch analysis on vmlinux.o, we lose valueble information about where the mismatch was introduced. Running the analysis for each module/built-in.o file - will tell where the mismatch happens much closer to the - source. The drawback is that we will report the same - mismatch at least twice. - - Enable verbose reporting from modpost to help solving - the section mismatches reported. + tells where the mismatch happens much closer to the + source. The drawback is that the same mismatch is + reported at least twice. + - Enable verbose reporting from modpost in order to help resolve + the section mismatches that are reported. config DEBUG_KERNEL bool "Kernel debugging" @@ -835,7 +835,7 @@ config DEBUG_CREDENTIALS # # Select this config option from the architecture Kconfig, if it -# it is preferred to always offer frame pointers as a config +# is preferred to always offer frame pointers as a config # option on the architecture (regardless of KERNEL_DEBUG): # config ARCH_WANT_FRAME_POINTERS @@ -1081,7 +1081,7 @@ config FAULT_INJECTION_STACKTRACE_FILTER depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT depends on !X86_64 select STACKTRACE - select FRAME_POINTER if !PPC && !S390 && !MICROBLAZE + select FRAME_POINTER if !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND help Provide stacktrace filter for fault-injection capabilities @@ -1091,7 +1091,7 @@ config LATENCYTOP depends on DEBUG_KERNEL depends on STACKTRACE_SUPPORT depends on PROC_FS - select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE + select FRAME_POINTER if !MIPS && !PPC && !S390 && !MICROBLAZE && !ARM_UNWIND select KALLSYMS select KALLSYMS_ALL select STACKTRACE diff --git a/lib/Makefile b/lib/Makefile index d5d175c8a6c..3f5bc6d903e 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -12,7 +12,7 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \ idr.o int_sqrt.o extable.o prio_tree.o \ sha1.o md5.o irq_regs.o reciprocal_div.o argv_split.o \ proportions.o prio_heap.o ratelimit.o show_mem.o \ - is_single_threaded.o plist.o decompress.o find_next_bit.o + is_single_threaded.o plist.o decompress.o lib-$(CONFIG_MMU) += ioremap.o lib-$(CONFIG_SMP) += cpumask.o @@ -22,7 +22,7 @@ lib-y += kobject.o kref.o klist.o obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ string_helpers.o gcd.o lcm.o list_sort.o uuid.o flex_array.o \ - bsearch.o find_last_bit.o + bsearch.o find_last_bit.o find_next_bit.o obj-y += kstrtox.o obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index cb4b74548a3..dcdade39e47 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -16,7 +16,6 @@ #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kallsyms.h> -#include <linux/version.h> #include <linux/types.h> #include <linux/mutex.h> #include <linux/proc_fs.h> diff --git a/lib/hexdump.c b/lib/hexdump.c index f5fe6ba7a3a..51d5ae21024 100644 --- a/lib/hexdump.c +++ b/lib/hexdump.c @@ -38,14 +38,21 @@ EXPORT_SYMBOL(hex_to_bin); * @dst: binary result * @src: ascii hexadecimal string * @count: result length + * + * Return 0 on success, -1 in case of bad input. */ -void hex2bin(u8 *dst, const char *src, size_t count) +int hex2bin(u8 *dst, const char *src, size_t count) { while (count--) { - *dst = hex_to_bin(*src++) << 4; - *dst += hex_to_bin(*src++); - dst++; + int hi = hex_to_bin(*src++); + int lo = hex_to_bin(*src++); + + if ((hi < 0) || (lo < 0)) + return -1; + + *dst++ = (hi << 4) | lo; } + return 0; } EXPORT_SYMBOL(hex2bin); diff --git a/lib/idr.c b/lib/idr.c index db040ce3fa7..5acf9bb1096 100644 --- a/lib/idr.c +++ b/lib/idr.c @@ -860,7 +860,7 @@ EXPORT_SYMBOL(ida_get_new_above); * and go back to the idr_pre_get() call. If the idr is full, it will * return %-ENOSPC. * - * @id returns a value in the range %0 ... %0x7fffffff. + * @p_id returns a value in the range %0 ... %0x7fffffff. */ int ida_get_new(struct ida *ida, int *p_id) { diff --git a/lib/sha1.c b/lib/sha1.c index f33271dd00c..1de509a159c 100644 --- a/lib/sha1.c +++ b/lib/sha1.c @@ -8,6 +8,7 @@ #include <linux/kernel.h> #include <linux/module.h> #include <linux/bitops.h> +#include <linux/cryptohash.h> #include <asm/unaligned.h> /* diff --git a/lib/xz/xz_dec_bcj.c b/lib/xz/xz_dec_bcj.c index e51e2558ca9..a768e6d28bb 100644 --- a/lib/xz/xz_dec_bcj.c +++ b/lib/xz/xz_dec_bcj.c @@ -441,8 +441,12 @@ XZ_EXTERN enum xz_ret xz_dec_bcj_run(struct xz_dec_bcj *s, * next filter in the chain. Apply the BCJ filter on the new data * in the output buffer. If everything cannot be filtered, copy it * to temp and rewind the output buffer position accordingly. + * + * This needs to be always run when temp.size == 0 to handle a special + * case where the output buffer is full and the next filter has no + * more output coming but hasn't returned XZ_STREAM_END yet. */ - if (s->temp.size < b->out_size - b->out_pos) { + if (s->temp.size < b->out_size - b->out_pos || s->temp.size == 0) { out_start = b->out_pos; memcpy(b->out + b->out_pos, s->temp.buf, s->temp.size); b->out_pos += s->temp.size; @@ -465,16 +469,25 @@ XZ_EXTERN enum xz_ret xz_dec_bcj_run(struct xz_dec_bcj *s, s->temp.size = b->out_pos - out_start; b->out_pos -= s->temp.size; memcpy(s->temp.buf, b->out + b->out_pos, s->temp.size); + + /* + * If there wasn't enough input to the next filter to fill + * the output buffer with unfiltered data, there's no point + * to try decoding more data to temp. + */ + if (b->out_pos + s->temp.size < b->out_size) + return XZ_OK; } /* - * If we have unfiltered data in temp, try to fill by decoding more - * data from the next filter. Apply the BCJ filter on temp. Then we - * hopefully can fill the actual output buffer by copying filtered - * data from temp. A mix of filtered and unfiltered data may be left - * in temp; it will be taken care on the next call to this function. + * We have unfiltered data in temp. If the output buffer isn't full + * yet, try to fill the temp buffer by decoding more data from the + * next filter. Apply the BCJ filter on temp. Then we hopefully can + * fill the actual output buffer by copying filtered data from temp. + * A mix of filtered and unfiltered data may be left in temp; it will + * be taken care on the next call to this function. */ - if (s->temp.size > 0) { + if (b->out_pos < b->out_size) { /* Make b->out{,_pos,_size} temporarily point to s->temp. */ s->out = b->out; s->out_pos = b->out_pos; |