Thread (8 messages) flat view 8 messages, 4 authors, 2012-02-05

Re: [PATCH] In crypto_add_alg(), 'exact' wants to be initialized to 0

From: Jesper Juhl <hidden>
Date: 2012-02-02 14:42:24
Also in: lkml

On Thu, 2 Feb 2012, Steffen Klassert wrote:
On Wed, Feb 01, 2012 at 09:21:39PM +0100, Jesper Juhl wrote:
quoted
On Wed, 1 Feb 2012, devendra.aaru wrote:
quoted
On Sun, Jan 29, 2012 at 5:39 PM, Jesper Juhl [off-list ref] wrote:
quoted
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.
Thank you for the explanation.

Can I take that to mean that I can add your Acked-by: if/when I resend the 
patch?

-- 
Jesper Juhl [off-list ref]       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help