Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6145608iog; Thu, 23 Jun 2022 12:17:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vjS07Rm6i0Ki/4v4dmFaQKAJ2e4n/nI+i7Sqnowk4cppTu+sv68UqUteXU5IEwB1l92rEx X-Received: by 2002:a17:903:2d0:b0:14d:8a8d:cb1 with SMTP id s16-20020a17090302d000b0014d8a8d0cb1mr39824941plk.50.1656011830342; Thu, 23 Jun 2022 12:17:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656011830; cv=none; d=google.com; s=arc-20160816; b=b68KqZqHikKq/I8CQBC8v7yd11HQ7/EKj+aiuHEnNHF2CkMJuL6TZj6AgUaQnx4lTr 1O73fiSZP5Zf8PnmcmsZ659J88ZjLr0rlIpOyhZoonoKT86EwksLP9fbRHln0Enpm3+K +aaTmqxykpSK908SzNS1nRNgZ0ze7aZjefcUZ3HjXzqrr/baK1m0JKsZYlBj3yu3mCG3 04M/MzKdvlFf9DNW/Pp0KDjLtC83q7EtqRp2CTxPskwAYw2Vl9w6oqLsR7JtUPyvDeE2 So1qE47qXQcdW4el1DkBAdRci435moVZb1lnH90dhksxO6IZVZpz63QI6miHZQGiJn+H r7Mg== 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=C7tDGA90jOyWCpTU1yoDLdzAwDrugAxKo1RjurVGaME=; b=FC6CWxB0S/juAKcI87shIw5njDyTZ9ZNqHGpldnfI3B6JCgt8MX7hA+He3fJF8qocq jmogB97rT/V/Kif4+T/znn+M+FKhaKBiSjqr6EDxn0yB5P5RuZ7wmWCqXl1YF+PCtzzL kFxH2nkCnKJjbaAl4hY0V5IK+ZaO8OcUOxwFWAgNrNu/CtrFAMwtLxQQSbL6d/CSdnJ4 7obewQ9MOkV3UZuYW0WUe1KyY2iGa9xoe/G500w8JzKw/Fka1Uled6bzGGyfQfcr01Yx Q4HlcAYl2PLNnt94JxO87B/6TCEXi5MFOIELF3hKuDeHZ5Z06mvcI39c/dFPyUAJkHlS 7LWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yEIRha59; 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 j3-20020a170903028300b0016a1f3f7c57si368939plr.607.2022.06.23.12.16.57; Thu, 23 Jun 2022 12:17:10 -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=yEIRha59; 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 S236041AbiFWSGb (ORCPT + 99 others); Thu, 23 Jun 2022 14:06:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235922AbiFWSFy (ORCPT ); Thu, 23 Jun 2022 14:05:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A18B4FE7; Thu, 23 Jun 2022 10:17:52 -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 42A55B824B9; Thu, 23 Jun 2022 17:17:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BE1FC3411B; Thu, 23 Jun 2022 17:17:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656004670; bh=N/NIA5jKRGapFcBKcTH4xUISDWf3g0Dhrm0AZVeEJeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yEIRha59FmgJP6sNNuqMVci8dqCT2WbYu9mJkJgswQWgCbnLdXjVhuG81G55nLHAQ 8iR98GalkHSET6IfLB/mkDX/pviJCKh20cx2G+wf+7dNGoZulQ96BknES2eoWp6Cz9 HoNkt9Ju5a9L2ly1piIE29xcimLwxgQ9wBA7B23w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso , Dominik Brodowski , "Jason A. Donenfeld" Subject: [PATCH 4.19 111/234] random: round-robin registers as ulong, not u32 Date: Thu, 23 Jun 2022 18:42:58 +0200 Message-Id: <20220623164346.199595693@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: "Jason A. Donenfeld" commit da3951ebdcd1cb1d5c750e08cd05aee7b0c04d9a upstream. When the interrupt handler does not have a valid cycle counter, it calls get_reg() to read a register from the irq stack, in round-robin. Currently it does this assuming that registers are 32-bit. This is _probably_ the case, and probably all platforms without cycle counters are in fact 32-bit platforms. But maybe not, and either way, it's not quite correct. This commit fixes that to deal with `unsigned long` rather than `u32`. Cc: Theodore Ts'o Reviewed-by: Dominik Brodowski Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- drivers/char/random.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1256,15 +1256,15 @@ int random_online_cpu(unsigned int cpu) } #endif -static u32 get_reg(struct fast_pool *f, struct pt_regs *regs) +static unsigned long get_reg(struct fast_pool *f, struct pt_regs *regs) { - u32 *ptr = (u32 *)regs; + unsigned long *ptr = (unsigned long *)regs; unsigned int idx; if (regs == NULL) return 0; idx = READ_ONCE(f->reg_idx); - if (idx >= sizeof(struct pt_regs) / sizeof(u32)) + if (idx >= sizeof(struct pt_regs) / sizeof(unsigned long)) idx = 0; ptr += idx++; WRITE_ONCE(f->reg_idx, idx);