From patchwork Sat Oct 21 17:15:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10021453 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9875160375 for ; Sat, 21 Oct 2017 17:17:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D13F28A90 for ; Sat, 21 Oct 2017 17:17:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7132A28A95; Sat, 21 Oct 2017 17:17:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 219D328A90 for ; Sat, 21 Oct 2017 17:17:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932196AbdJURRI (ORCPT ); Sat, 21 Oct 2017 13:17:08 -0400 Received: from mout.web.de ([212.227.15.14]:64981 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932149AbdJURRH (ORCPT ); Sat, 21 Oct 2017 13:17:07 -0400 Received: from [192.168.1.2] ([78.49.207.83]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MVLY6-1diRYR0AHu-00Ykxo; Sat, 21 Oct 2017 19:15:57 +0200 Subject: [PATCH 2/3] crypto-ansi_cprng: Delete two variable assignments in get_prng_bytes() From: SF Markus Elfring To: linux-crypto@vger.kernel.org, "David S. Miller" , Herbert Xu , Neil Horman Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <7318b066-5233-426e-4b21-d4969b96bf67@users.sourceforge.net> Date: Sat, 21 Oct 2017 19:15:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:eUnabCNiDSmNhA0Rf0+2iLRb0JBjyDsDQ5fgqmdCq1KEnnw5/xu v0+6xKz320bMzoy/PaOkjAaq+ZFYCt77Fd/XzwLdG+eQKioveWB5x4ei60WeA2XX0QeW+1g o2a1/lgjj6MHkMlHxCexruBHSzy7hQBdqFo+vZPcekV0nQg8YLbr3WXGZtoYxmTjA1tuTiE 0wixNwQEr/JZmh3Pj5Dvw== X-UI-Out-Filterresults: notjunk:1; V01:K0:krgvUoTP8JI=:pjCftp5uCrlnar0ixNwLpN 5cf8KkFWWxu16jXJdq3D2LSZGWNvea1fGeAIZoGyh8+4EaIQrHcoR7NQNftKrPzf0gxi6b48p 2KK5OmxJRVD2KDBDniESxqTA9veBndSa32AuA5o+bJxE8RmjkHXrK2KLKujc97YlfYfvpWKdf 7vCqOpIUM7BTsxkzgNFI7IsZ2rGMIgqjlFWAk5+a9GIDn95ZoatH0o1M4UQYHRHBbAQTILhD1 j14oLHbKdGrPZmQpN1Ef9eKbTMcxlCGoIhfPTZhIZ+8E2iul6HK0cRB0AVdKv9yKSTASnC5MW CGzAcXA8GKsEd4hpJD624VedjGa5RwavgnqMR89YOC4riYYfBnsUyVakGdHb5O4gegKblxnWu x9MgRNkEP3WROppKaZIm3GoLRQGfnnqLPJ+s55a/WtxbnvVAcQUOHp3j+EgZOI7LiVjanb+mC +aDvt5g04BYeA8n4GFJ5CCpfS12TgP3G+09HU0XMrdblWrhzjudRYdT1Zuu7ag5yq/OZJDirg JPHYUXsIUGM2Sl6pPqSzQSYNOdX8T6ZQQ9sX1xPl7nPKp4G1zG5nrbbRknkfqtATS9R+tANVt 1XnxwDlwi6kui1shElIH8UrM2BUjkApjBaaIxMogX26cZP0/PLKgTBTe7a/EocjMgU9nPc2f4 Fal4vAYqOJUdZBjgDbcF8iVpwQOFZNZrdaob7ay3R/6oBXwoh1bSohWtLyo0xRFviX1m/ujPC ONKpmSlYIAQ2Gz+tlFsyZwM5L/spyqBrUBQfeh6NWbfPcDxHZfzymiRIJrj7ndf8zZB/D7JSU OrOrrDZG7rtlIQgqlFgqtbdU3jYFkE2hhTFnu62fQqgCtQKxGQ= Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring 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 --- 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; }