From c0eedf803467620fd3bdafccdd761990f6bd42e1 Mon Sep 17 00:00:00 2001 From: Stephan Mueller Date: Mon, 23 Jun 2014 09:11:29 +0200 Subject: 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 Signed-off-by: Stephan Mueller Signed-off-by: Herbert Xu --- crypto/drbg.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crypto/drbg.c') diff --git a/crypto/drbg.c b/crypto/drbg.c index faaa2cefeeed..99fa8f89fb3e 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 */ -- cgit v1.2.3-59-g8ed1b