[PATCH 2/3] crypto-ansi_cprng: Delete two variable assignments in get_prng_bytes()

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

 



From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 21 Oct 2017 16:10:43 +0200

Adjust a jump target so that two error code assignments which are redundant
before condition checks can be removed because the same value will be set
as an exception handling at the end of this function.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
 crypto/ansi_cprng.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/crypto/ansi_cprng.c b/crypto/ansi_cprng.c
index 111c8982a47f..3d805bf6d0c6 100644
--- a/crypto/ansi_cprng.c
+++ b/crypto/ansi_cprng.c
@@ -192,19 +192,16 @@ static int get_prng_bytes(char *buf, size_t nbytes, struct prng_context *ctx,
 
 
 	spin_lock_bh(&ctx->prng_lock);
-
-	err = -EINVAL;
 	if (ctx->flags & PRNG_NEED_RESET)
-		goto unlock;
+		goto failure_indication;
 
 	/*
 	 * If the FIXED_SIZE flag is on, only return whole blocks of
 	 * pseudo random data
 	 */
-	err = -EINVAL;
 	if (ctx->flags & PRNG_FIXED_SIZE) {
 		if (nbytes < DEFAULT_BLK_SZ)
-			goto unlock;
+			goto failure_indication;
 		byte_count = DEFAULT_BLK_SZ;
 	}
 
@@ -267,6 +264,7 @@ static int get_prng_bytes(char *buf, size_t nbytes, struct prng_context *ctx,
 
 reset_memory:
 	memset(buf, 0, nbytes);
+failure_indication:
 	err = -EINVAL;
 	goto unlock;
 }
-- 
2.14.2

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



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux