diff options
| author | Tanya Agarwal <tanyaagarwal25699@gmail.com> | 2025-01-14 19:42:04 +0530 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-04-10 14:37:30 +0200 |
| commit | 77461377d3bee6865ebab5150e65d9ba7b994343 (patch) | |
| tree | ddea1899271a2c19d9a72a3225cf34351d11dfc3 /lib | |
| parent | 43681d603ff0c6caa919d5b7569bf8ed32f8e055 (diff) | |
| download | linux-77461377d3bee6865ebab5150e65d9ba7b994343.tar.gz linux-77461377d3bee6865ebab5150e65d9ba7b994343.tar.bz2 linux-77461377d3bee6865ebab5150e65d9ba7b994343.zip | |
lib: 842: Improve error handling in sw842_compress()
[ Upstream commit af324dc0e2b558678aec42260cce38be16cc77ca ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/842/842_compress.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/842/842_compress.c b/lib/842/842_compress.c index c02baa4168e1..055356508d97 100644 --- a/lib/842/842_compress.c +++ b/lib/842/842_compress.c @@ -532,6 +532,8 @@ int sw842_compress(const u8 *in, unsigned int ilen, } if (repeat_count) { ret = add_repeat_template(p, repeat_count); + if (ret) + return ret; repeat_count = 0; if (next == last) /* reached max repeat bits */ goto repeat; |
