mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH V2] lib: Fix return check in 842_compress.c
@ 2024-12-29  6:39 Tanya Agarwal
  0 siblings, 0 replies; only message in thread
From: Tanya Agarwal @ 2024-12-29  6:39 UTC (permalink / raw)
  To: haren
  Cc: Markus.Elfring, kernel-janitors, linux-kernel, skhan,
	anupnewsmail, tanyaagarwal25699

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-12-29  6:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-29  6:39 [PATCH V2] lib: Fix return check in 842_compress.c Tanya Agarwal

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®