[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LRH.2.02.2006301414120.30526@file01.intranet.prod.int.rdu2.redhat.com>
Date: Tue, 30 Jun 2020 14:14:25 -0400 (EDT)
From: Mikulas Patocka <mpatocka@...hat.com>
To: Eric Biggers <ebiggers@...nel.org>
cc: Mike Snitzer <msnitzer@...hat.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Zaibo Xu <xuzaibo@...wei.com>, linux-kernel@...r.kernel.org,
Wei Xu <xuwei5@...ilicon.com>, dm-devel@...hat.com,
George Cherian <gcherian@...vell.com>,
linux-crypto@...r.kernel.org,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
"David S. Miller" <davem@...emloft.net>,
Milan Broz <mbroz@...hat.com>
Subject: Re: [dm-devel] [PATCH 1/3 v4] crypto: introduce the flag
CRYPTO_ALG_ALLOCATES_MEMORY
On Tue, 30 Jun 2020, Eric Biggers wrote:
> On Tue, Jun 30, 2020 at 01:01:16PM -0400, Mikulas Patocka wrote:
> > > diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
> > > index 7240e8bbdebb..643f7f1cc91c 100644
> > > --- a/crypto/pcrypt.c
> > > +++ b/crypto/pcrypt.c
> > > @@ -232,12 +232,15 @@ static int pcrypt_create_aead(struct crypto_template *tmpl, struct rtattr **tb,
> > > struct crypto_attr_type *algt;
> > > struct aead_instance *inst;
> > > struct aead_alg *alg;
> > > + u32 mask;
> > > int err;
> > >
> > > algt = crypto_get_attr_type(tb);
> > > if (IS_ERR(algt))
> > > return PTR_ERR(algt);
> > >
> > > + mask = crypto_alg_inherited_mask(algt->type, algt->mask);
> > > +
> > > inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL);
> > > if (!inst)
> > > return -ENOMEM;
> > > @@ -254,7 +257,7 @@ static int pcrypt_create_aead(struct crypto_template *tmpl, struct rtattr **tb,
> > > goto err_free_inst;
> > >
> > > err = crypto_grab_aead(&ctx->spawn, aead_crypto_instance(inst),
> > > - crypto_attr_alg_name(tb[1]), 0, 0);
> > > + crypto_attr_alg_name(tb[1]), 0, mask);
> > > if (err)
> > > goto err_free_inst;
> > >
> >
> > I added "mask" there - but there is still a "mask" argument that is
> > unused - is it a bug to have two "mask" variables?
>
> Right, I didn't see that algt->type and algt->mask are already being passed to
> pcrypt_create_aead(). It's redundant because pcrypt_create_aead() has access to
> those via crypto_get_attr_type() anyway.
>
> How about just removing those two arguments for now?
>
> - Eric
Yes.
Mikulas
Powered by blists - more mailing lists