]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
crypto: lz4,lz4hc - fix decompression
authorKOVACS Krisztian <hidden@sch.bme.hu>
Fri, 22 Aug 2014 08:44:35 +0000 (10:44 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 29 Aug 2014 13:46:35 +0000 (21:46 +0800)
The lz4 library has two functions for decompression, with slightly
different signatures and behaviour. The lz4_decompress_crypto() function
seemed to be using the one that assumes that the decompressed length is
known in advance.

This patch switches to the other decompression function and makes sure
that the length of the decompressed output is properly returned to the
caller.

The same issue was present in the lz4hc algorithm.

Coincidentally, this change also makes very basic lz4 and lz4hc
compression tests in testmgr pass.

Signed-off-by: KOVACS Krisztian <hidden@sch.bme.hu>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/lz4.c
crypto/lz4hc.c

index 4586dd15b0d8909b286c136aedecde335803dc7d..34d072b72a734e14d988aa8b9023ea9069d23079 100644 (file)
@@ -68,7 +68,7 @@ static int lz4_decompress_crypto(struct crypto_tfm *tfm, const u8 *src,
        size_t tmp_len = *dlen;
        size_t __slen = slen;
 
-       err = lz4_decompress(src, &__slen, dst, tmp_len);
+       err = lz4_decompress_unknownoutputsize(src, __slen, dst, &tmp_len);
        if (err < 0)
                return -EINVAL;
 
index 151ba31d34e39e120cf8d16d8aaf28f909b2c3f1..9218b3fed5e377ff085093e56e80f0d498e605fa 100644 (file)
@@ -68,7 +68,7 @@ static int lz4hc_decompress_crypto(struct crypto_tfm *tfm, const u8 *src,
        size_t tmp_len = *dlen;
        size_t __slen = slen;
 
-       err = lz4_decompress(src, &__slen, dst, tmp_len);
+       err = lz4_decompress_unknownoutputsize(src, __slen, dst, &tmp_len);
        if (err < 0)
                return -EINVAL;