summaryrefslogtreecommitdiff
path: root/crypto/drbg.c
diff options
context:
space:
mode:
authorStephan Mueller <smueller@chronox.de>2014-06-23 09:11:29 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2014-06-26 14:46:31 +0800
commit9ec706720224936df8cd211e55d512e20d559f0a (patch)
tree856361b9581631ecbdf43d38c130536b55d86ae2 /crypto/drbg.c
parent76e8405ac3ad34eb41c0e89ce7c7f33c78abbfdd (diff)
downloadlinux-crypto-9ec706720224936df8cd211e55d512e20d559f0a.tar.gz
linux-crypto-9ec706720224936df8cd211e55d512e20d559f0a.zip
crypto: drbg - simplify ordering of linked list in drbg_ctr_df
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> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/drbg.c')
-rw-r--r--crypto/drbg.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/crypto/drbg.c b/crypto/drbg.c
index faaa2cef..99fa8f89 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;
/* 10.4.2 step 9 */