From: Steffen Klassert <steffen.klassert@secunet.com>
To: Jesper Juhl <jj@chaosbits.net>
Cc: "devendra.aaru" <devendra.aaru@gmail.com>,
Herbert Xu <herbert@gondor.hengli.com.au>,
"David S. Miller" <davem@davemloft.net>,
linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org
Subject: Re: [PATCH] In crypto_add_alg(), 'exact' wants to be initialized to 0
Date: Thu, 2 Feb 2012 08:51:22 +0100 [thread overview]
Message-ID: <20120202075122.GA23142@secunet.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1202012050390.8577@swampdragon.chaosbits.net>
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@chaosbits.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
next prev parent reply other threads:[~2012-02-02 7:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-29 22:39 [PATCH] In crypto_add_alg(), 'exact' wants to be initialized to 0 Jesper Juhl
2012-02-01 10:43 ` devendra.aaru
2012-02-01 20:21 ` Jesper Juhl
2012-02-01 20:36 ` Jesper Juhl
2012-02-02 7:51 ` Steffen Klassert [this message]
2012-02-02 14:42 ` Jesper Juhl
2012-02-03 6:24 ` Steffen Klassert
2012-02-05 4:12 ` Herbert Xu
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=20120202075122.GA23142@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=davem@davemloft.net \
--cc=devendra.aaru@gmail.com \
--cc=herbert@gondor.hengli.com.au \
--cc=jj@chaosbits.net \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).