Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6045485iog; Thu, 23 Jun 2022 10:10:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v6Ve/fqlCpZ36Va60d7egt5/QB1uDPIqOM+h/3jQaFQ2szWPq2bkYaKeH6Hi9jxXg/uNLy X-Received: by 2002:a05:6402:254c:b0:435:c541:fc8d with SMTP id l12-20020a056402254c00b00435c541fc8dmr6534731edb.385.1656004257506; Thu, 23 Jun 2022 10:10:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656004257; cv=none; d=google.com; s=arc-20160816; b=UxTkgAs9RN9CxKykaLgJfnWp3QLcFRAUIwDY8SkXVYjtHXzbgXHLZb2rxrOgCGka0a ekylbJJNmzQZFWJHT9BDnfjVcfDX8hZAhidpP1StB63DDlI2NzjlCNdZN7BOmEBOXSRY u9kj0yEX0XUX/KgcevfXs2Y8TrBQQs0JDY8EhPz3ypUfz6d7dY0FetUXoOszuih1MVrK oD0hKvgog7noxtdHo/eXde9kVvDW92Ga0gvLM9CrOp9w85wHWGv2fdkBXG3o0wX6iPX2 gZtirxZGnE6N7hDbUB9jyDKWt3PNhowWQXjIcFy7nha/W114SPWzFb/clhkBHe1wxJVy Qo9w== 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=x6q0glELHHk/NEZngKLsfneaL37Ra2MKFsj3xEhUrag=; b=UOzcbAwEg62IqQealTZBoqvLoh4WZ1LXN5+4mCOB/E0PDmnBMUOP99qU6mGfpa6Dfy t2pTiriTao8tce70hEETAAi1AyS9Y2RcYiGzSj3E23qJO6CnlTy5bbuGb7Y2+hzJyW4a r00fLj7K6EM9Hp5J7GSmzCVbbOKTUtF1VSGgxdYXFphBoKLpP1jGeVCQPOupFpup50Il CINejsd5pREZGdT0rF5/3hEOtqRv8Ut/LKRN0JIc3VuS1gkiVEnnzCdNNhIasJRo2fRN nE6vQH4kfhxlqIOlC67HAIS+9KN3jIHCpkpS0Z3Ylexpgr3xSZq+PRD3BmwZfUpfQU7j NKBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YY5BlpqU; 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 1-20020a170906208100b00722e1ba9675si7032063ejq.949.2022.06.23.10.10.30; Thu, 23 Jun 2022 10:10:57 -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=YY5BlpqU; 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 S229596AbiFWRBL (ORCPT + 99 others); Thu, 23 Jun 2022 13:01:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232387AbiFWQzO (ORCPT ); Thu, 23 Jun 2022 12:55:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D22B1C90F; Thu, 23 Jun 2022 09:52:55 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 104AC61FC2; Thu, 23 Jun 2022 16:52:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB2F7C3411B; Thu, 23 Jun 2022 16:52:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656003174; bh=ntBuGWY/Q+9zWoprDMG6nKxd4AqpclY4u+giu3jGLr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YY5BlpqUMWEAcmbTTuRjbWLD99VN83YmNEkmfA8Ks1A3nu4PbF0eiWduR9vOb7Op9 egCTuAgkv+KucJik+Z7MhkcGDRojOAqE7/zXTpQv2cWUixtpjLEWiYQWd0ZHE5GkUu vf3qx27INLrFhTTgTfynyyPzLgSIOy5N+0wniZpQ= 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.9 154/264] random: round-robin registers as ulong, not u32 Date: Thu, 23 Jun 2022 18:42:27 +0200 Message-Id: <20220623164348.421783134@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: "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 @@ -1257,15 +1257,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);