* [PATCH V3] lib: 842: Improve error handling in sw842_compress()
@ 2025-01-04 18:49 Tanya Agarwal
2025-01-05 1:06 ` Kuan-Wei Chiu
2025-01-14 3:45 ` Herbert Xu
0 siblings, 2 replies; 4+ messages in thread
From: Tanya Agarwal @ 2025-01-04 18:49 UTC (permalink / raw)
To: haren
Cc: ddstreet, herbert, Markus.Elfring, kernel-janitors, linux-kernel,
skhan, anupnewsmail, tanyaagarwal25699
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V3] lib: 842: Improve error handling in sw842_compress()
2025-01-04 18:49 [PATCH V3] lib: 842: Improve error handling in sw842_compress() Tanya Agarwal
@ 2025-01-05 1:06 ` Kuan-Wei Chiu
2025-01-14 3:45 ` Herbert Xu
1 sibling, 0 replies; 4+ messages in thread
From: Kuan-Wei Chiu @ 2025-01-05 1:06 UTC (permalink / raw)
To: Tanya Agarwal
Cc: haren, ddstreet, herbert, Markus.Elfring, kernel-janitors,
linux-kernel, skhan, anupnewsmail
On Sun, Jan 05, 2025 at 12:19:54AM +0530, Tanya Agarwal wrote:
> 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>
LGTM. Thanks!
Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Regards,
Kuan-Wei
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V3] lib: 842: Improve error handling in sw842_compress()
2025-01-04 18:49 [PATCH V3] lib: 842: Improve error handling in sw842_compress() Tanya Agarwal
2025-01-05 1:06 ` Kuan-Wei Chiu
@ 2025-01-14 3:45 ` Herbert Xu
2025-01-14 14:13 ` Tanya Agarwal
1 sibling, 1 reply; 4+ messages in thread
From: Herbert Xu @ 2025-01-14 3:45 UTC (permalink / raw)
To: Tanya Agarwal
Cc: haren, ddstreet, Markus.Elfring, kernel-janitors, linux-kernel,
skhan, anupnewsmail
On Sun, Jan 05, 2025 at 12:19:54AM +0530, Tanya Agarwal wrote:
> 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(+)
Please resend via linux-crypto@vger.kernel.org. The MAINTAINERS
entry should be updated to include the mailing list.
Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V3] lib: 842: Improve error handling in sw842_compress()
2025-01-14 3:45 ` Herbert Xu
@ 2025-01-14 14:13 ` Tanya Agarwal
0 siblings, 0 replies; 4+ messages in thread
From: Tanya Agarwal @ 2025-01-14 14:13 UTC (permalink / raw)
To: Herbert Xu
Cc: haren, ddstreet, Markus.Elfring, kernel-janitors, linux-kernel,
skhan, anupnewsmail
On Tue, Jan 14, 2025 at 9:15 AM Herbert Xu <herbert@gondor.apana.org.au> wrote:
>
> On Sun, Jan 05, 2025 at 12:19:54AM +0530, Tanya Agarwal wrote:
> > From: Tanya Agarwal <tanyaagarwal25699@gmail.com>
>
> Please resend via linux-crypto@vger.kernel.org. The MAINTAINERS
> entry should be updated to include the mailing list.
Done. Thanks for pointing it out.
https://lore.kernel.org/all/20250114141203.1421-1-tanyaagarwal25699@gmail.com/
>
> Thanks,
> --
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-01-14 14:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-04 18:49 [PATCH V3] lib: 842: Improve error handling in sw842_compress() Tanya Agarwal
2025-01-05 1:06 ` Kuan-Wei Chiu
2025-01-14 3:45 ` Herbert Xu
2025-01-14 14:13 ` 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®