[prev in list] [next in list] [prev in thread] [next in thread]
List: dm-devel
Subject: Re: [dm-devel] [PATCH 1/3 v4] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY
From: Mikulas Patocka <mpatocka () redhat ! com>
Date: 2020-06-30 18:14:25
Message-ID: alpine.LRH.2.02.2006301414120.30526 () file01 ! intranet ! prod ! int ! rdu2 ! redhat ! com
[Download RAW message or body]
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
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic