mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Stephan Mueller <smueller@chronox.de>
Cc: kbuild test robot <fengguang.wu@intel.com>,
	kbuild@01.org, linux-kernel@vger.kernel.org,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Rafael Aquini <aquini@redhat.com>,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: Re: [PATCH v2] DRBG: simplify ordering of linked list in drbg_ctr_df
Date: Thu, 26 Jun 2014 14:45:42 +0800	[thread overview]
Message-ID: <20140626064542.GA17761@gondor.apana.org.au> (raw)
In-Reply-To: <20140625090828.GD8727@gondor.apana.org.au>

On Wed, Jun 25, 2014 at 05:08:28PM +0800, Herbert Xu wrote:
> On Mon, Jun 23, 2014 at 09:11:29AM +0200, Stephan Mueller wrote:
> > As reported by a static code analyzer, the code for the ordering of
> > the linked list can be simplified.
> > 
> > Reported-by: kbuild test robot <fengguang.wu@intel.com>
> > Signed-off-by: Stephan Mueller <smueller@chronox.de>
> > ---
> >  crypto/drbg.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/crypto/drbg.c b/crypto/drbg.c
> > index faaa2ce..99fa8f8 100644
> > --- a/crypto/drbg.c
> > +++ b/crypto/drbg.c
> > @@ -516,13 +516,13 @@ static int drbg_ctr_df(struct drbg_state *drbg,
> >  	S2.next = addtl;
> >  
> >  	/*
> > -	 * splice in addtl between S2 and S4 -- we place S4 at the end of the
> > -	 * input data chain
> > +	 * Splice in addtl between S2 and S4 -- we place S4 at the end
> > +	 * of the input data chain. As this code is only triggered when
> > +	 * addtl is not NULL, no NULL checks are necessary.
> >  	 */
> >  	tempstr = addtl;
> > -	for (; NULL != tempstr; tempstr = tempstr->next)
> > -		if (NULL == tempstr->next)
> > -			break;
> > +	while (tempstr->next)
> > +		tempstr = tempstr->next;
> >  	tempstr->next = &S4;
> 
> This is still broken.

OK I take that back.  As addtl is not NULL neither version will
do a NULL derference.  But I will apply your cleanup patch anyway.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2014-06-26  6:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-23  7:10 Stephan Mueller
2014-06-23  7:11 ` Stephan Mueller
2014-06-25  9:08   ` Herbert Xu
2014-06-26  6:45     ` Herbert Xu [this message]
2014-06-26 11:33       ` Stephan Mueller

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=20140626064542.GA17761@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=aquini@redhat.com \
    --cc=dan.carpenter@oracle.com \
    --cc=fengguang.wu@intel.com \
    --cc=kbuild@01.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=smueller@chronox.de \
    /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

all inboxes | Powered by JetHome®