LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Dongliang Mu <mudongliangabcd@gmail.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Corentin Labbe <clabbe.montjoie@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Maxime Ripard <mripard@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Eric Biggers <ebiggers@google.com>,
	Xiang Chen <chenxiang66@hisilicon.com>,
	Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	Corentin Labbe <clabbe@baylibre.com>,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	linux-crypto@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] crypto: sun8i-ce: fix multiple memory leaks in sun8i_ce_hash_run
Date: Thu, 12 Aug 2021 18:40:20 +0800	[thread overview]
Message-ID: <CAD-N9QU6r-yLBvJUpV+xy4pgOFnrtquBymthG7k5ddHt20APzg@mail.gmail.com> (raw)
In-Reply-To: <20210812102954.GA5569@gondor.apana.org.au>

On Thu, Aug 12, 2021 at 6:30 PM Herbert Xu <herbert@gondor.apana.org.au> wrote:
>
> On Thu, Aug 12, 2021 at 06:24:25PM +0800, Dongliang Mu wrote:
> > On Thu, Aug 12, 2021 at 6:05 PM Herbert Xu <herbert@gondor.apana.org.au> wrote:
> > >
> > > On Tue, Aug 03, 2021 at 02:31:38PM +0800, Dongliang Mu wrote:
> > > >
> > > > -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 <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2021-08-12 10:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03  6:31 Dongliang Mu
2021-08-12 10:04 ` Herbert Xu
2021-08-12 10:24   ` Dongliang Mu
2021-08-12 10:29     ` Herbert Xu
2021-08-12 10:40       ` Dongliang Mu [this message]
2021-08-12 10:43         ` Herbert Xu
2021-08-16 13:21           ` Dongliang Mu
2021-09-23  0:54             ` Dongliang Mu

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=CAD-N9QU6r-yLBvJUpV+xy4pgOFnrtquBymthG7k5ddHt20APzg@mail.gmail.com \
    --to=mudongliangabcd@gmail.com \
    --cc=Jason@zx2c4.com \
    --cc=ardb@kernel.org \
    --cc=chenxiang66@hisilicon.com \
    --cc=clabbe.montjoie@gmail.com \
    --cc=clabbe@baylibre.com \
    --cc=davem@davemloft.net \
    --cc=ebiggers@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=mchehab+huawei@kernel.org \
    --cc=mripard@kernel.org \
    --cc=wens@csie.org \
    --subject='Re: [PATCH v2] crypto: sun8i-ce: fix multiple memory leaks in sun8i_ce_hash_run' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).