Skip to content
This repository has been archived by the owner on Nov 21, 2022. It is now read-only.

Commit

Permalink
lib/decompress_unlz4: change module to work with new LZ4 module version
Browse files Browse the repository at this point in the history
Update the unlz4 wrapper to work with the updated LZ4 kernel module
version.

Link: http://lkml.kernel.org/r/1486321748-19085-3-git-send-email-4sschmid@informatik.uni-hamburg.de
Signed-off-by: Sven Schmidt <4sschmid@informatik.uni-hamburg.de>
Cc: Bongkyu Kim <bongkyu.kim@lge.com>
Cc: Rui Salvaterra <rsalvaterra@gmail.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: David S. Miller <davem@davemloft.net>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Tony Luck <tony.luck@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
SvSchmidt authored and torvalds committed Feb 25, 2017
1 parent 4e1a33b commit e23d54e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/decompress_unlz4.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ STATIC inline int INIT unlz4(u8 *input, long in_len,
error("NULL input pointer and missing fill function");
goto exit_1;
} else {
inp = large_malloc(lz4_compressbound(uncomp_chunksize));
inp = large_malloc(LZ4_compressBound(uncomp_chunksize));
if (!inp) {
error("Could not allocate input buffer");
goto exit_1;
Expand Down Expand Up @@ -136,7 +136,7 @@ STATIC inline int INIT unlz4(u8 *input, long in_len,
inp += 4;
size -= 4;
} else {
if (chunksize > lz4_compressbound(uncomp_chunksize)) {
if (chunksize > LZ4_compressBound(uncomp_chunksize)) {
error("chunk length is longer than allocated");
goto exit_2;
}
Expand All @@ -152,11 +152,14 @@ STATIC inline int INIT unlz4(u8 *input, long in_len,
out_len -= dest_len;
} else
dest_len = out_len;
ret = lz4_decompress(inp, &chunksize, outp, dest_len);

ret = LZ4_decompress_fast(inp, outp, dest_len);
chunksize = ret;
#else
dest_len = uncomp_chunksize;
ret = lz4_decompress_unknownoutputsize(inp, chunksize, outp,
&dest_len);

ret = LZ4_decompress_safe(inp, outp, chunksize, dest_len);
dest_len = ret;
#endif
if (ret < 0) {
error("Decoding failed");
Expand Down

0 comments on commit e23d54e

Please sign in to comment.