lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7318b066-5233-426e-4b21-d4969b96bf67@users.sourceforge.net>
Date:   Sat, 21 Oct 2017 19:15:54 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux-crypto@...r.kernel.org,
        "David S. Miller" <davem@...emloft.net>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        Neil Horman <nhorman@...driver.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH 2/3] crypto-ansi_cprng: Delete two variable assignments in
 get_prng_bytes()

From: Markus Elfring <elfring@...rs.sourceforge.net>
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@...rs.sourceforge.net>
---
 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ