diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Makefile | 4 | ||||
| -rw-r--r-- | lib/sha1.c | 1 | ||||
| -rw-r--r-- | lib/xz/xz_dec_bcj.c | 27 |
3 files changed, 23 insertions, 9 deletions
diff --git a/lib/Makefile b/lib/Makefile index d5d175c8a6ca..3f5bc6d903e0 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
| @@ -12,7 +12,7 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \ | |||
| 12 | idr.o int_sqrt.o extable.o prio_tree.o \ | 12 | idr.o int_sqrt.o extable.o prio_tree.o \ |
| 13 | sha1.o md5.o irq_regs.o reciprocal_div.o argv_split.o \ | 13 | sha1.o md5.o irq_regs.o reciprocal_div.o argv_split.o \ |
| 14 | proportions.o prio_heap.o ratelimit.o show_mem.o \ | 14 | proportions.o prio_heap.o ratelimit.o show_mem.o \ |
| 15 | is_single_threaded.o plist.o decompress.o find_next_bit.o | 15 | is_single_threaded.o plist.o decompress.o |
| 16 | 16 | ||
| 17 | lib-$(CONFIG_MMU) += ioremap.o | 17 | lib-$(CONFIG_MMU) += ioremap.o |
| 18 | lib-$(CONFIG_SMP) += cpumask.o | 18 | lib-$(CONFIG_SMP) += cpumask.o |
| @@ -22,7 +22,7 @@ lib-y += kobject.o kref.o klist.o | |||
| 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 lcm.o list_sort.o uuid.o flex_array.o \ | 24 | string_helpers.o gcd.o lcm.o list_sort.o uuid.o flex_array.o \ |
| 25 | bsearch.o find_last_bit.o | 25 | bsearch.o find_last_bit.o find_next_bit.o |
| 26 | obj-y += kstrtox.o | 26 | obj-y += kstrtox.o |
| 27 | obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o | 27 | obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o |
| 28 | 28 | ||
diff --git a/lib/sha1.c b/lib/sha1.c index f33271dd00cb..1de509a159c8 100644 --- a/lib/sha1.c +++ b/lib/sha1.c | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
| 9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
| 10 | #include <linux/bitops.h> | 10 | #include <linux/bitops.h> |
| 11 | #include <linux/cryptohash.h> | ||
| 11 | #include <asm/unaligned.h> | 12 | #include <asm/unaligned.h> |
| 12 | 13 | ||
| 13 | /* | 14 | /* |
diff --git a/lib/xz/xz_dec_bcj.c b/lib/xz/xz_dec_bcj.c index e51e2558ca9d..a768e6d28bbb 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, | |||
| 441 | * next filter in the chain. Apply the BCJ filter on the new data | 441 | * next filter in the chain. Apply the BCJ filter on the new data |
| 442 | * in the output buffer. If everything cannot be filtered, copy it | 442 | * in the output buffer. If everything cannot be filtered, copy it |
| 443 | * to temp and rewind the output buffer position accordingly. | 443 | * to temp and rewind the output buffer position accordingly. |
| 444 | * | ||
| 445 | * This needs to be always run when temp.size == 0 to handle a special | ||
| 446 | * case where the output buffer is full and the next filter has no | ||
| 447 | * more output coming but hasn't returned XZ_STREAM_END yet. | ||
| 444 | */ | 448 | */ |
| 445 | if (s->temp.size < b->out_size - b->out_pos) { | 449 | if (s->temp.size < b->out_size - b->out_pos || s->temp.size == 0) { |
| 446 | out_start = b->out_pos; | 450 | out_start = b->out_pos; |
| 447 | memcpy(b->out + b->out_pos, s->temp.buf, s->temp.size); | 451 | memcpy(b->out + b->out_pos, s->temp.buf, s->temp.size); |
| 448 | b->out_pos += s->temp.size; | 452 | b->out_pos += s->temp.size; |
| @@ -465,16 +469,25 @@ XZ_EXTERN enum xz_ret xz_dec_bcj_run(struct xz_dec_bcj *s, | |||
| 465 | s->temp.size = b->out_pos - out_start; | 469 | s->temp.size = b->out_pos - out_start; |
| 466 | b->out_pos -= s->temp.size; | 470 | b->out_pos -= s->temp.size; |
| 467 | memcpy(s->temp.buf, b->out + b->out_pos, s->temp.size); | 471 | memcpy(s->temp.buf, b->out + b->out_pos, s->temp.size); |
| 472 | |||
| 473 | /* | ||
| 474 | * If there wasn't enough input to the next filter to fill | ||
| 475 | * the output buffer with unfiltered data, there's no point | ||
| 476 | * to try decoding more data to temp. | ||
| 477 | */ | ||
| 478 | if (b->out_pos + s->temp.size < b->out_size) | ||
| 479 | return XZ_OK; | ||
| 468 | } | 480 | } |
| 469 | 481 | ||
| 470 | /* | 482 | /* |
| 471 | * If we have unfiltered data in temp, try to fill by decoding more | 483 | * We have unfiltered data in temp. If the output buffer isn't full |
| 472 | * data from the next filter. Apply the BCJ filter on temp. Then we | 484 | * yet, try to fill the temp buffer by decoding more data from the |
| 473 | * hopefully can fill the actual output buffer by copying filtered | 485 | * next filter. Apply the BCJ filter on temp. Then we hopefully can |
| 474 | * data from temp. A mix of filtered and unfiltered data may be left | 486 | * fill the actual output buffer by copying filtered data from temp. |
| 475 | * in temp; it will be taken care on the next call to this function. | 487 | * A mix of filtered and unfiltered data may be left in temp; it will |
| 488 | * be taken care on the next call to this function. | ||
| 476 | */ | 489 | */ |
| 477 | if (s->temp.size > 0) { | 490 | if (b->out_pos < b->out_size) { |
| 478 | /* Make b->out{,_pos,_size} temporarily point to s->temp. */ | 491 | /* Make b->out{,_pos,_size} temporarily point to s->temp. */ |
| 479 | s->out = b->out; | 492 | s->out = b->out; |
| 480 | s->out_pos = b->out_pos; | 493 | s->out_pos = b->out_pos; |
