Received: by 10.192.165.156 with SMTP id m28csp76924imm; Tue, 10 Apr 2018 16:48:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/ys6NN6ZKBauB2WYZ609wgWN2zyDOFlhoLDd2tNYIBA/LAq7tpZBoyZnhWdd/YgxJjaOke X-Received: by 10.99.111.140 with SMTP id k134mr1736243pgc.11.1523404103890; Tue, 10 Apr 2018 16:48:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523404103; cv=none; d=google.com; s=arc-20160816; b=EDak0OcqGQCgCfh/bJ5TSEy1SB5BBYfVoh9P0r7hCizLa9YM/KIFkdQZGe5ZhKYKNw xJbZl5cQEL/PWRlJ542o93YIyShvnmbTQNvXEhFTrSMyA3qBYbedYBNFIFVW58oJGVQl UCN6XdTrsT1uxpZhia3AaQjfwG7waZqM3vQDLio/54KatqUuMFs3lFByxDPSQPszq2Wp gV1kMrE6voDfO63GxWp5H2NCGFiXTCty8rJhxHRi050ECP+2TWiBT5i8broOdisDTv4N daHl1EtHb0BUt4FSgWf2Ht94zmrfKdqNyZ6gjCO7Kl+9n2gSFleDL8KlQCzh3lRhd/wg Td4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=AgXgSZP9UiAZgJbaqBybBWl3VNu8YVX/gxhK7uPLF5s=; b=COQqL4urYVqEvZ5Kqv9uq1fm3xx27NTZMGnNZYLm/mUE6nGf5jRKmxAGBjTEXQKGAd lFpDqrf98m4AIoW9Sh1Jaj/LvpHYlRZzVNWScvjYYsVL2d6ODSf5BG//7Noh0CuobTcw fqIXPdiB8H9w2ftBM1K+KZxRmFUTa/x+YqE0wh3lBJqShviz/0Bedq8izbRW/YWnuXvW C3hIZItOZm2vJJuh3wAnpPV/UJJg419QAbmbKFev2gUPf3Fc5CnKASI36qnPd4FGNLlp NL1KkQALYaAj6MTlFuDEjvi1JlCwLtFrzmmyJ5rrhpsj924cCkjvFDU2nEjthSoxtnv1 y/Yg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9si2348479pgo.687.2018.04.10.16.47.47; Tue, 10 Apr 2018 16:48:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754672AbeDJXnX (ORCPT + 99 others); Tue, 10 Apr 2018 19:43:23 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37104 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752997AbeDJW0I (ORCPT ); Tue, 10 Apr 2018 18:26:08 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id ECED2D0B; Tue, 10 Apr 2018 22:26:07 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Blumenstingl , Jerome Brunet , Sasha Levin Subject: [PATCH 4.15 004/168] clk: meson: mpll: use 64-bit maths in params_from_rate Date: Wed, 11 Apr 2018 00:22:26 +0200 Message-Id: <20180410212800.398693109@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Martin Blumenstingl [ Upstream commit 86aacdca66774051cbc0958110a48074b57a060b ] "rem * SDM_DEN" can easily overflow on the 32-bit Meson8 and Meson8b SoCs if the "remainder" (after the division operation) is greater than 262143Hz. This is likely to happen since the input clock for the MPLLs on Meson8 and Meson8b is "fixed_pll", which is running at a rate of 2550MHz. One example where this was observed to be problematic was the Ethernet clock calculation (which takes MPLL2 as input). When requesting a rate of 125MHz there is a remainder of 2500000Hz. The resulting MPLL2 rate before this patch was 127488329Hz. The resulting MPLL2 rate after this patch is 124999103Hz. Commit b609338b26f5 ("clk: meson: mpll: use 64bit math in rate_from_params") already fixed a similar issue in rate_from_params. Fixes: 007e6e5c5f01d3 ("clk: meson: mpll: add rw operation") Signed-off-by: Martin Blumenstingl Signed-off-by: Jerome Brunet Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/clk/meson/clk-mpll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/clk/meson/clk-mpll.c +++ b/drivers/clk/meson/clk-mpll.c @@ -98,7 +98,7 @@ static void params_from_rate(unsigned lo *sdm = SDM_DEN - 1; } else { *n2 = div; - *sdm = DIV_ROUND_UP(rem * SDM_DEN, requested_rate); + *sdm = DIV_ROUND_UP_ULL((u64)rem * SDM_DEN, requested_rate); } }