RE: [PATCH] crypto: caam - Fix key inlining in AEAD shared descriptors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Kim

> -----Original Message-----
> From: Kim Phillips [mailto:kim.phillips@xxxxxxxxxxxxx]
> Sent: Tuesday, May 06, 2014 12:07 AM
> To: Garg Vakul-B16394
> Cc: Phillips Kim-R1AAHA; linux-crypto@xxxxxxxxxxxxxxx;
> herbert@xxxxxxxxxxxxxxxxxxx; Geanta Neag Horia Ioan-B05471; Gupta
> Ruchika-R66431; Porosanu Alexandru-B06830
> Subject: Re: [PATCH] crypto: caam - Fix key inlining in AEAD shared
> descriptors
> 
> On Sat, 3 May 2014 06:44:39 -0500
> Garg Vakul-B16394 <vakul@xxxxxxxxxxxxx> wrote:
> 
> > > From: Kim Phillips [mailto:kim.phillips@xxxxxxxxxxxxx]
> > > Sent: Saturday, May 03, 2014 5:40 AM
> > >
> > > On Sun, 27 Apr 2014 11:26:14 -0400
> > > Vakul Garg <vakul@xxxxxxxxxxxxx> wrote:
> > >
> > > > @@ -220,6 +220,8 @@ static int aead_null_set_sh_desc(struct
> > > > crypto_aead
> > > *aead)
> > > >  	if (DESC_AEAD_NULL_ENC_LEN + DESC_JOB_IO_LEN +
> > > >  	    ctx->split_key_pad_len <= CAAM_DESC_BYTES_MAX)
> > > >  		keys_fit_inline = true;
> > > > +	else
> > > > +		keys_fit_inline = false;
> > >
> > > Can we do the easier to read:
> > >
> > > 	keys_fit_inline = false;
> > > 	if (DESC_AEAD_NULL_ENC_LEN + DESC_JOB_IO_LEN +
> > > 	    ctx->split_key_pad_len <= CAAM_DESC_BYTES_MAX)
> > > 		keys_fit_inline = true;
> > >
> > > ?
> >
> > Why pre-init a variable with default value when it could be
> overwritten?
> 
> why not?  compiler output doesn't differ in this regard.
> 

Agree that compiler output doesn't differ.
But why depend upon compiler's optimization capability while writing code when we can be explicit?

> > I think that the form I submitted is equally easy to read.
> 
> adding one line instead of two -> less lines overall -> more code on one
> screen -> easier to read.
> 

I think that this is a matter of personal coding choice.
Both the approaches are fine and compliant to kernel coding guidelines.

> Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux