From: Tanya Agarwal <tanyaagarwal25699@gmail.com>
To: haren@us.ibm.com
Cc: 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 V2] lib: Fix return check in 842_compress.c
Date: Sun, 29 Dec 2024 12:09:45 +0530 [thread overview]
Message-ID: <20241229063944.2252-1-tanyaagarwal25699@gmail.com> (raw)
From: Tanya Agarwal <tanyaagarwal25699@gmail.com>
Improve error handling in sw842_compress() for add_repeat_template().
Note that this error case is already properly handled later in other
add_repeat_template() function calls.
CID 1309755: (#1 of 1): Unused value (UNUSED_VALUE)
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.
Coverity Link:
https://scan5.scan.coverity.com/#/project-view/63683/10063?selectedIssue=1309755
Fixes: 2da572c959dd ("lib: add software 842 compression/decompression")
Signed-off-by: Tanya Agarwal <tanyaagarwal25699@gmail.com>
---
Changes in V2:
- Updated commit msg
- Link to V1: https://lore.kernel.org/all/20241228074246.3572-1-tanyaagarwal25699@gmail.com
---
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
reply other threads:[~2024-12-29 6:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20241229063944.2252-1-tanyaagarwal25699@gmail.com \
--to=tanyaagarwal25699@gmail.com \
--cc=Markus.Elfring@web.de \
--cc=anupnewsmail@gmail.com \
--cc=haren@us.ibm.com \
--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®