[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 2 Feb 2012 08:51:22 +0100
From: Steffen Klassert <steffen.klassert@...unet.com>
To: Jesper Juhl <jj@...osbits.net>
Cc: "devendra.aaru" <devendra.aaru@...il.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
linux-kernel@...r.kernel.org, linux-crypto@...r.kernel.org
Subject: Re: [PATCH] In crypto_add_alg(), 'exact' wants to be initialized
to 0
On Wed, Feb 01, 2012 at 09:21:39PM +0100, Jesper Juhl wrote:
> On Wed, 1 Feb 2012, devendra.aaru wrote:
>
> > On Sun, Jan 29, 2012 at 5:39 PM, Jesper Juhl <jj@...osbits.net> wrote:
> > > We declare 'exact' without initializing it and then do:
> > >
> > > [...]
> > > if (strlen(p->cru_driver_name))
> > > exact = 1;
> > >
> > > if (priority && !exact)
> > > return -EINVAL;
> > >
> > > [...]
> > >
> > > If the first 'if' is not true, then the second will test an
> > > uninitialized 'exact'.
> >
> > not needed . as the cru_driver_name will always be present :).
>
> If that is indeed the case, and we are guaranteed that, then it would seem
> that a patch like the following would be what we want instead??
>
> Please note that this patch is intended just for discussion, nothing else
> (which is why I left out a Signed-off-by on purpose), since I've not
> tested it beyond checking that it compiles, nor have I verified your claim
> that cru_driver_name will always be present.
>
We get cru_driver_name from a netlink message that a user sends us.
So it depends pretty much on the user whether cru_driver_name is
set or not. Usually it is set when a user wants to instantiate
a certain algorithm driver, like "cbc(aes-asm)". If the user just
wants to instantiate the system default of an algorithm, he can
set cru_name (e.g. to "cbc(aes)") instead of cru_driver_name.
Your first patch is correct.
Thanks,
Steffen
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists