Thread (8 messages) 8 messages, 2 authors, 2021-09-23

Re: [PATCH v2] crypto: sun8i-ce: fix multiple memory leaks in sun8i_ce_hash_run

From: Dongliang Mu <hidden>
Date: 2021-08-12 10:40:52
Also in: linux-arm-kernel, linux-crypto, lkml

On Thu, Aug 12, 2021 at 6:30 PM Herbert Xu [off-list ref] wrote:
On Thu, Aug 12, 2021 at 06:24:25PM +0800, Dongliang Mu wrote:
quoted
On Thu, Aug 12, 2021 at 6:05 PM Herbert Xu [off-list ref] wrote:
quoted
On Tue, Aug 03, 2021 at 02:31:38PM +0800, Dongliang Mu wrote:
quoted
-theend:
-     kfree(buf);
+err_result:
      kfree(result);
-     crypto_finalize_hash_request(engine, breq, err);
+err_buf:
+     kfree(buf);
+out:
+     if (!err)
+             crypto_finalize_hash_request(engine, breq, err);
      return 0;
This does not look right.  You're returning zero in case of an error
Hi Herbert,

Corentin Labbe said,

For the error code, I am not sure it is needed, error code is already
given to user via crypto_finalize_hash_request().
Yes but your patch changes this.  You're now skipping the finalize
call and thus throwing away err if it's not zero.
I see. Thanks for your comment.

I agree with you and would like to modify "return 0" to "return err"
in the next version.  Even if the parent function does not care about
the return value, it is still necessary to keep the right return
value.

Corentin, how do you think?
If it's supposed to do this you need to explain it in your patch
submission.

Cheers,
--
Email: Herbert Xu [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help