Skip to content

Commit af324dc

Browse files
TanyaAgarwal25herbertx
authored andcommitted
lib: 842: Improve error handling in sw842_compress()
The static code analysis tool "Coverity Scan" pointed the following implementation details out for further development considerations: CID 1309755: Unused value In sw842_compress: A value assigned to a variable is never used. (CWE-563) returned_value: Assigning value from add_repeat_template(p, repeat_count) to ret here, but that stored value is overwritten before it can be used. Conclusion: Add error handling for the return value from an add_repeat_template() call. Fixes: 2da572c ("lib: add software 842 compression/decompression") Signed-off-by: Tanya Agarwal <tanyaagarwal25699@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 9739f5f commit af324dc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/842/842_compress.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,8 @@ int sw842_compress(const u8 *in, unsigned int ilen,
532532
}
533533
if (repeat_count) {
534534
ret = add_repeat_template(p, repeat_count);
535+
if (ret)
536+
return ret;
535537
repeat_count = 0;
536538
if (next == last) /* reached max repeat bits */
537539
goto repeat;

0 commit comments

Comments
 (0)