Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6140422iog; Thu, 23 Jun 2022 12:11:08 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t4TDixNzPYJGCYr+IE+I8NR8KHubIUvDTnKbujYNEAB3Ehf+axAs+YRy9yKWoCvLMQC1y8 X-Received: by 2002:a63:7519:0:b0:40d:677:b89b with SMTP id q25-20020a637519000000b0040d0677b89bmr8800371pgc.49.1656011468073; Thu, 23 Jun 2022 12:11:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656011468; cv=none; d=google.com; s=arc-20160816; b=oQBWF7Ih/ShNY3TqkVa7VLFKSmskLB1o8Jyi/JS8wonva8eZK+Tjrc2YRez56i3phz mYE7DEDCGHkya86/WLdDLWs9pl4+Hje4rzitbR+gEToVdX99bXzxZBPdaAXnxQZH9VD+ d/NE+hEHuBs/B3XbPIIugWPAyV10FKvgWNQN3U7UHkSKEKkfouE2d6HWiiBydnFNS8h+ fEkLDFLd7M+nkRJSIfCUKgJjyffP2cJH1+YjHyJ8OWlVPbkASxyqXBFco3zQesK7AZCl ZS7691Ziy+XGovlnyK/AEPDW3AwMh5tRriGzuDM+9luewRzO3ckyQrQTJ8iP8SX+StyG JtpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Pg95sfc4WW33cKWhEaIHNLbOyHIYmwle27zBuSd0b4c=; b=UEOf3RgWDFI3tq6YYGOf5A6J1zpJAaCcpXWcjA5ljBaSPHsw+E03nTOnnEjVTbd/Zo fV3PcBRjOEBbrvsZyLpDZMD+cMb9M/KakSoWXs1Uizo/lwyrYOMCmKoUtIVTCDjP4Uw0 zHRgtDAe9x0/5lbbN5xlq10US+z+HKIhlNDH86UaxNM8Z6NeiSceGPSe37uSESY1YQps /yxorK/MiqMqUSvGAuLcT5yH9LGR4CJE+uVI4JKPxMzQGEkRsxUarP7DPYuNMGrO0dco uUPO1N8aeLR4wXlKyGOmMSUyeqIyC9vyp7ujqt1rkRm4QNuz8Nhjz/PkDXuNOJZYtHvf vs6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="CskNbn/R"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f10-20020a056a001aca00b0050e0a0b03afsi30903100pfv.362.2022.06.23.12.10.55; Thu, 23 Jun 2022 12:11:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="CskNbn/R"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231190AbiFWQ7m (ORCPT + 99 others); Thu, 23 Jun 2022 12:59:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233160AbiFWQu1 (ORCPT ); Thu, 23 Jun 2022 12:50:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72CBB4EA12; Thu, 23 Jun 2022 09:48:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CEAF2B82490; Thu, 23 Jun 2022 16:48:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FF6BC3411B; Thu, 23 Jun 2022 16:48:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656002897; bh=Ddg1gfGWpnvl1shfneyA+XSeB3QnW3yp84eQDhHFI0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CskNbn/RmE5rW880uFaEExnis0OWSM5qrETF219v/TTdC2lyWay86wNN1fANEaCwd XDUFL0S4AkK2BvVdSDEqnGI4Fk01uim/J5jdLxt4uHx2S5GqsLOhDdumGmCspuSS8A /4lYmx3Z1+/qAD/kiEOsfeUJlRvu/xMUtFpKzDmQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yangtao Li , Theodore Tso , "Jason A. Donenfeld" Subject: [PATCH 4.9 062/264] random: remove unnecessary unlikely() Date: Thu, 23 Jun 2022 18:40:55 +0200 Message-Id: <20220623164345.826929831@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164344.053938039@linuxfoundation.org> References: <20220623164344.053938039@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yangtao Li commit 870e05b1b18814911cb2703a977f447cb974f0f9 upstream. WARN_ON() already contains an unlikely(), so it's not necessary to use unlikely. Signed-off-by: Yangtao Li Link: https://lore.kernel.org/r/20190607182517.28266-1-tiny.windzz@gmail.com Signed-off-by: Theodore Ts'o Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- drivers/char/random.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -739,10 +739,9 @@ retry: } while (unlikely(entropy_count < pool_size-2 && pnfrac)); } - if (unlikely(entropy_count < 0)) { + if (WARN_ON(entropy_count < 0)) { pr_warn("random: negative entropy/overflow: pool %s count %d\n", r->name, entropy_count); - WARN_ON(1); entropy_count = 0; } else if (entropy_count > pool_size) entropy_count = pool_size; @@ -1432,10 +1431,9 @@ retry: if (ibytes < min) ibytes = 0; - if (unlikely(entropy_count < 0)) { + if (WARN_ON(entropy_count < 0)) { pr_warn("random: negative entropy count: pool %s count %d\n", r->name, entropy_count); - WARN_ON(1); entropy_count = 0; } nfrac = ibytes << (ENTROPY_SHIFT + 3);