crypto: lz4 - fixed decompress function to return error code

Decompress function in LZ4 library is supposed to return an error code or
negative result. But, it returns -1 when any error is detected. Return
error code when the library returns negative value.

Signed-off-by: Myungho Jung <mhjungk@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Myungho Jung 2017-04-09 17:34:22 -07:00 committed by Herbert Xu
parent 07a77929ba
commit cd15f1020f
2 changed files with 2 additions and 2 deletions

View File

@ -97,7 +97,7 @@ static int __lz4_decompress_crypto(const u8 *src, unsigned int slen,
int out_len = LZ4_decompress_safe(src, dst, slen, *dlen);
if (out_len < 0)
return out_len;
return -EINVAL;
*dlen = out_len;
return 0;

View File

@ -98,7 +98,7 @@ static int __lz4hc_decompress_crypto(const u8 *src, unsigned int slen,
int out_len = LZ4_decompress_safe(src, dst, slen, *dlen);
if (out_len < 0)
return out_len;
return -EINVAL;
*dlen = out_len;
return 0;