From patchwork Mon Sep 21 07:58:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolai Stange X-Patchwork-Id: 11788653 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 87BF6618 for ; Mon, 21 Sep 2020 07:59:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 779DD20874 for ; Mon, 21 Sep 2020 07:59:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726405AbgIUH7R (ORCPT ); Mon, 21 Sep 2020 03:59:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:56444 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726318AbgIUH7R (ORCPT ); Mon, 21 Sep 2020 03:59:17 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2E41AB4FC; Mon, 21 Sep 2020 07:59:51 +0000 (UTC) From: Nicolai Stange To: "Theodore Y. Ts'o" Cc: linux-crypto@vger.kernel.org, LKML , Arnd Bergmann , Greg Kroah-Hartman , "Eric W. Biederman" , "Alexander E. Patrakov" , "Ahmed S. Darwish" , Willy Tarreau , Matthew Garrett , Vito Caputo , Andreas Dilger , Jan Kara , Ray Strode , William Jon McCann , zhangjs , Andy Lutomirski , Florian Weimer , Lennart Poettering , Peter Matthias , Marcelo Henrique Cerri , Roman Drahtmueller , Neil Horman , Randy Dunlap , Julia Lawall , Dan Carpenter , Andy Lavr , Eric Biggers , "Jason A. Donenfeld" , =?utf-8?q?Stephan_M=C3=BCller?= , Torsten Duwe , Petr Tesarik , Nicolai Stange Subject: [RFC PATCH 03/41] random: prune dead assignment to entropy_bits in credit_entropy_bits() Date: Mon, 21 Sep 2020 09:58:19 +0200 Message-Id: <20200921075857.4424-4-nstange@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200921075857.4424-1-nstange@suse.de> References: <20200921075857.4424-1-nstange@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Since commit 90ea1c6436d2 ("random: remove the blocking pool"), the last assignment to 'entropy_bits' is dead. Remove it. While at it, move the declaration of 'entropy_bits' one scope down and make it const: it's not used anywhere outside and never updated after initialization. Signed-off-by: Nicolai Stange --- drivers/char/random.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index c4b7bdbd460e..14c39608cc17 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -716,13 +716,12 @@ static void credit_entropy_bits(struct entropy_store *r, int nbits) entropy_count >> ENTROPY_SHIFT, _RET_IP_); if (r == &input_pool) { - int entropy_bits = entropy_count >> ENTROPY_SHIFT; - if (crng_init < 2) { + const int entropy_bits = entropy_count >> ENTROPY_SHIFT; + if (entropy_bits < 128) return; crng_reseed(&primary_crng, r); - entropy_bits = ENTROPY_BITS(r); } } }