Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6136319iog; Thu, 23 Jun 2022 12:06:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tE6HoAPyyZ/OYlalGyZCP2JTQualzdTHCEh21GvUAJM2LL40O/NDBTKsDBfxMhbtFqCUYB X-Received: by 2002:a63:1014:0:b0:40d:2117:b0d with SMTP id f20-20020a631014000000b0040d21170b0dmr8849873pgl.56.1656011184542; Thu, 23 Jun 2022 12:06:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656011184; cv=none; d=google.com; s=arc-20160816; b=LhDUrdBPESqeHEmmIveuXIqlfMSN1Fvr9qtp45IWZ5XK/oQNSLOQ3pYSlFJhzdLGsz cLNktx0FsWDdjI58I93NLoYyaBnJJJL9kOtgXs/S6XtOSrd3K4MduCVhsoHBT3k6WdRo 8GsJtoaaWomQ58LKhKDIQTcU5GGTg69syLsyHCa+CblvtBc/rdgPxFz0rLt43bNPAXUS l8w/SvrlN3uB4ogehhz5/n/NPeKTKOzRK3oByTSo/W1VI7OiP1/NbMC+bCzl3gcpl3OT DAHnIW68/TZ73qEZqpJpx1cXIY44l1iwpkqDwuuNY3SLOjU2PDFYr9ZZZtoC2iSlNoxO 8Fkg== 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=mUmfGiXb10g/kwqZykvEWon6q2v0abN91V4zIUHr6OA=; b=DYRYUfAmfYf/KtUhl23j6QJooNnMamTvskUtru2+HBmUB9fc5ldX+7bbvxf8OFMWlE rINVtvQX1XeQ3PU+sWtNyYudne4ED2SnJkeZSNZ/oi60Wp+orJ4Sm4i7ShvrUV/U3Irp s3QzijnQbiCCD3oMiuAVwdiXuMBlGXkuOkFHXAoX1qj3hltpsRmMLqUXVqYx7NUd8bcV xf2ZYD9VD3wxGXMJma8hLQ59YdR/zMJaplwGIV/vAsnBqsONcb27btIocSKOUrxIaMxy tXU68YM2f+Up25J7U30k+WW1EEDNgR1sj8MkFVmZ+hDNZHAWtczu4yNorp1ikjczGGDP 94ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=J3zvq4+F; 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 a6-20020a1709027e4600b00168f7b5a84csi353176pln.242.2022.06.23.12.06.12; Thu, 23 Jun 2022 12:06:24 -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=J3zvq4+F; 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 S235418AbiFWRzs (ORCPT + 99 others); Thu, 23 Jun 2022 13:55:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235475AbiFWRwo (ORCPT ); Thu, 23 Jun 2022 13:52:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5CF056753; Thu, 23 Jun 2022 10:13:31 -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 CC501B824C0; Thu, 23 Jun 2022 17:13:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2156FC3411B; Thu, 23 Jun 2022 17:13:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656004408; bh=RyjBYvJarK0fEcO+XSsnBDGxh8WRAAYAEBi+RJNIeaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J3zvq4+FhmfsQqYRPQOUWxIXQiMopSVnMYFIRtHDYMaXBA4C/EIb36HSc4fm15EB4 jy8N+8XWwiDcxKUPwO+x8ijU//nb6FuFsJmxaoP2SpcnPuq8ieVnH9o0uYhI+CdlQh AM4T/pDhbkq/SAhtj6sJcAxg9hKt9B02Xh+mPh8Q= 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.19 028/234] random: remove unnecessary unlikely() Date: Thu, 23 Jun 2022 18:41:35 +0200 Message-Id: <20220623164343.861303963@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164343.042598055@linuxfoundation.org> References: <20220623164343.042598055@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 @@ -738,10 +738,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; @@ -1383,10 +1382,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);