Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2942399iog; Mon, 20 Jun 2022 07:59:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vbjr/abiY6U5bcu1mExNLN5M3vXEMwp4CBg84BXvIcIn/CCEka6sNsd6gny2174kmvjVzP X-Received: by 2002:a17:903:1206:b0:168:e5af:469d with SMTP id l6-20020a170903120600b00168e5af469dmr24447796plh.55.1655737152252; Mon, 20 Jun 2022 07:59:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655737152; cv=none; d=google.com; s=arc-20160816; b=IFtQ8ocgf1pIdRakXEBiTCjJLcH6gHwkwjQmvQL6Zp6XSqOyBHr1CTLdXAR5Yco0Cj 5YxeUjCgzAG+cwpsepOgdaDPROiOoD549MCMBd8EMM64LeIzNEJsuEUFVhQBfvueq0Wf Af2+OxExGPQEuYXHQC0GJ+dQWt4XMsJi9OAuWaAKTdYwK1hGPiBEv3svVhUvIx0NmTpy +6nwEmQpqhHVjIz4HQoVtacPMB+N62VymAtchBGtZpw25Q4VJrVwdy4e1KE+qhoDXlou YdcMLCP4KDuRMzcXk9qV+z24AyTJDXIhMPy/Vrk+GKiwnz1YXzvt/hD0AqTKDXYTUShV HkmQ== 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=WNzNlpmrgjA0VwpTgYzV+m6tALLcsEEu7lgn/foMz1E=; b=HG3CBpgHoEy4aTQwqOGAOIHqFEk36zBRaUWpz4XkR3Tu72RlLOEdmrxMdmolHPC2Ye QjZgWIQ1CE3zKffkfEnsDY6B5OGRcM/n8KJafkrXm0xkDRMGhMKCKeHBdn0QzVsHmz1G jEoCC2LOHXg1qvLPK7eTMwIMLkAfSvEItqfmOQ1IikamxC9oEX6UyDDFEU3Pn4gZNDSv Spl+7/Us9c0NdL2xneOPjz24aemnrJGEzTQsj82rc0gDUubJ0RAHTPCULQWu4GvTsYzL Vx5Z0Zl3Lc9UEz/UmQjvGzXQu0PBp84za8gpXERvf0ea+avUoo7JCci+j5x+bKcoEtH4 LMHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ScpGiY1i; 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 q10-20020a170902daca00b00163ebcca926si4767661plx.2.2022.06.20.07.58.59; Mon, 20 Jun 2022 07:59:12 -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=ScpGiY1i; 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 S1349076AbiFTNsZ (ORCPT + 99 others); Mon, 20 Jun 2022 09:48:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348989AbiFTNro (ORCPT ); Mon, 20 Jun 2022 09:47: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 EABF62EA3B; Mon, 20 Jun 2022 06:17:36 -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 2F4A8B811F2; Mon, 20 Jun 2022 13:17:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87CF8C3411B; Mon, 20 Jun 2022 13:17:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655731051; bh=YVFCm9IvwmgkDNWZPZYSkH8bYCAZpNilJPeiWNu6Xuk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ScpGiY1ifLYKQdBAapQE9rfeZhXqHdCCT1+rXx3MF3qnmSHh4MRblcUQoxcsV/KWk iw20QwiJA6GicbzJqL68lbmgMiOeFm6IDGJ/gg39l5SAoVn4YsL9gL/reAAZ8nofLT uNXJYkOhUYb0jjNGtQ2tWUyKIw0Tcx45yErXbKoQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Arnd Bergmann , Geert Uytterhoeven , "Jason A. Donenfeld" Subject: [PATCH 5.4 137/240] m68k: use fallback for random_get_entropy() instead of zero Date: Mon, 20 Jun 2022 14:50:38 +0200 Message-Id: <20220620124742.978509676@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124737.799371052@linuxfoundation.org> References: <20220620124737.799371052@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: "Jason A. Donenfeld" commit 0f392c95391f2d708b12971a07edaa7973f9eece upstream. In the event that random_get_entropy() can't access a cycle counter or similar, falling back to returning 0 is really not the best we can do. Instead, at least calling random_get_entropy_fallback() would be preferable, because that always needs to return _something_, even falling back to jiffies eventually. It's not as though random_get_entropy_fallback() is super high precision or guaranteed to be entropic, but basically anything that's not zero all the time is better than returning zero all the time. Cc: Thomas Gleixner Cc: Arnd Bergmann Acked-by: Geert Uytterhoeven Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- arch/m68k/include/asm/timex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/m68k/include/asm/timex.h +++ b/arch/m68k/include/asm/timex.h @@ -35,7 +35,7 @@ static inline unsigned long random_get_e { if (mach_random_get_entropy) return mach_random_get_entropy(); - return 0; + return random_get_entropy_fallback(); } #define random_get_entropy random_get_entropy