Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 2da572c959dd ("lib: add software 842 compression/decompression")
Signed-off-by: Tanya Agarwal <tanyaagarwal25699@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Tanya Agarwal and committed by
Herbert Xu
af324dc0 9739f5f9

+2
+2
lib/842/842_compress.c
··· 532 532 } 533 533 if (repeat_count) { 534 534 ret = add_repeat_template(p, repeat_count); 535 + if (ret) 536 + return ret; 535 537 repeat_count = 0; 536 538 if (next == last) /* reached max repeat bits */ 537 539 goto repeat;