From: Tanya Agarwal <tanyaagarwal25699@gmail.com>
To: haren@us.ibm.com
Cc: ddstreet@ieee.org, herbert@gondor.apana.org.au,
Markus.Elfring@web.de, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org, skhan@linuxfoundation.org,
anupnewsmail@gmail.com, tanyaagarwal25699@gmail.com
Subject: [PATCH V3] lib: 842: Improve error handling in sw842_compress()
Date: Sun, 5 Jan 2025 00:19:54 +0530 [thread overview]
Message-ID: <20250104184951.3481-1-tanyaagarwal25699@gmail.com> (raw)
From: Tanya Agarwal <tanyaagarwal25699@gmail.com>
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>
---
V3: update title and reorganize commit description
V2: add Fixes tag and reword commit description
Coverity Link:
https://scan5.scan.coverity.com/#/project-view/63683/10063?selectedIssue=1309755
lib/842/842_compress.c | 2 ++
1 file changed, 2 insertions(+)
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;
--
2.39.5
next reply other threads:[~2025-01-04 18:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-04 18:49 Tanya Agarwal [this message]
2025-01-05 1:06 ` Kuan-Wei Chiu
2025-01-14 3:45 ` Herbert Xu
2025-01-14 14:13 ` Tanya Agarwal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250104184951.3481-1-tanyaagarwal25699@gmail.com \
--to=tanyaagarwal25699@gmail.com \
--cc=Markus.Elfring@web.de \
--cc=anupnewsmail@gmail.com \
--cc=ddstreet@ieee.org \
--cc=haren@us.ibm.com \
--cc=herbert@gondor.apana.org.au \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®