Skip to contentSkip to conversation

crypto: lz4: fixed decompress function to return error code

PATCH In review Myungho Jung 2 participants 2 messages Apr 10, 2017 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 crypto/lz4.c   | 2 +-
 crypto/lz4hc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
crypto/lz4.c +1 -1
index 71eff9b..2ce2660 100644
@@ -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;
crypto/lz4hc.c +1 -1
index 03a34a8..2be14f0 100644
@@ -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;
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 5 lines · Myungho Jung

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.

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt