Received: by 10.192.165.156 with SMTP id m28csp51860imm; Tue, 10 Apr 2018 16:12:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx48EQ6Ye/OZmuQvSdHqukWd5oIlApfW8OMA9Mxhel8hBocJP/M7bL2MXLqc9PywMfx29yuyR X-Received: by 10.99.181.13 with SMTP id y13mr1599228pge.279.1523401925601; Tue, 10 Apr 2018 16:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523401925; cv=none; d=google.com; s=arc-20160816; b=YLxIAx/zlPENeX5cR3Se9pQY6IwPkd1/4JbMcTBsl/Iwz9ixtEKA7uHMLMuSVaXAjx qADXx5of1BOYFor9B8FJ7VfO9kty/LvD9hToTlRktFn4B0p4QEyM+zKoFMTM6SDxuYKv uVqnRD0baWn1AbmxbIZ1SVfEYYU+2wefnfQpC15d8Q3yPNc0rWfbWTw+BYzM6oOuw9r3 VUFhTjKnI5SxqrZtpcD/UyzW7seHGKFOjmrwthJYzMhSfmjlmEuuWG4ZIbJOXTmYWC/K drmltaOJn2qJ9TdHK7w/ZDg7mLMHBLNg1reudOocyJN73fc7HXkNSyb/FOyjdeUyxSA5 BpRw== 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=lFSW/RxJOPeoHGU40Y8lT5cRBneh2NSAvSnuEQZTAYg=; b=RHBFYlG/yoKwlKypPhlvav94IeKUU1RnZMBmnuh9McVRznUQXyHluyUVXY11uJ890c zyTUgCtZl8ja9MasM07MQEol1CV25tOWPyatlUM3cOBKIaWpR4ZgMhue+MZRRqfk/zc9 +r0UOfHL4zUclgSGJxAEY4x35YGPsCWV4VXHtA0/pvSBtfhYHB2RXGrVF3qfDDp44oKe IOKEzEpFDJ4cH3Puzd116XsVWEyAT4yC1XZCwXNjVsml9eeCJ+z0cFz3Qjc7BgsTRX9y IIKOn0AfzXKQZ0ZOln6aJxgCWZLs4CQL6JOsMcw3Ghbd0uI6Xcdz+9QcF1D9HrSqCgEX 8Zuw== 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 w16-v6si3448401plp.621.2018.04.10.16.11.29; Tue, 10 Apr 2018 16:12:05 -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 S1755370AbeDJWeE (ORCPT + 99 others); Tue, 10 Apr 2018 18:34:04 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41562 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755349AbeDJWeD (ORCPT ); Tue, 10 Apr 2018 18:34:03 -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 4206ACDB; Tue, 10 Apr 2018 22:34:02 +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.14 004/138] clk: meson: mpll: use 64-bit maths in params_from_rate Date: Wed, 11 Apr 2018 00:23:14 +0200 Message-Id: <20180410212902.589492631@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212902.121524696@linuxfoundation.org> References: <20180410212902.121524696@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.14-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); } }