Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935549AbeAKSDr (ORCPT + 1 other); Thu, 11 Jan 2018 13:03:47 -0500 Received: from mail-he1eur01on0079.outbound.protection.outlook.com ([104.47.0.79]:31584 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932454AbeAKSDp (ORCPT ); Thu, 11 Jan 2018 13:03:45 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ed.blake@sondrel.com; Subject: Re: [PATCH] 8250_dw: do not int overflow when rate can not be aplied To: =?UTF-8?Q?Nuno_Gon=c3=a7alves?= Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org References: <20180111133832.13125-1-nunojpg@gmail.com> <57ef28bd-41da-73c2-3004-f9b2ecd8b102@sondrel.com> <60dd87e2-ea07-5da3-f426-f39ef3c1addf@sondrel.com> From: Ed Blake Message-ID: <4fc98be4-e489-20f0-d899-e5eabdbd5e9d@sondrel.com> Date: Thu, 11 Jan 2018 18:03:36 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [195.88.9.101] X-ClientProxiedBy: DB6PR07CA0060.eurprd07.prod.outlook.com (2603:10a6:6:2a::22) To HE1P191MB0153.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:c6::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 10f7dbfd-01cf-4b26-0736-08d5591da5ef X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603307)(7153060)(7193020);SRVR:HE1P191MB0153; X-Microsoft-Exchange-Diagnostics: 1;HE1P191MB0153;3:leap+x8aIi65AvW2k64/jW1MzRmCVvOGBFp726UrY8j0otMiCtBrah222mr5qZrT7AvSb39nc7UpK/gcXOhnrYY47rSuBL2YfDM/uWFd5zcWm5MmMqIl1qJDCTLcMYmCORzOAXViRbJ9poPHLcyHexEF2NijRp2IHsxQ3eeAzEQZ4CLw90CdefbxSu0tstQPoCC2H0RJQrCgVbUXD8tVeKos4IerP5Xk8jUv/H1acOEh7rZuMxkht8kotJCXgNYK;25:FNvK+2hMnEUE6DkFhGvQ+qkg6XUl+R3+kmc/SkB6GqLS4NiJh+nUxjyq/AEs1NZj/ZyyvnQXzu/+a+y8OQqYGq8i9J9wS9Qw4EtpR7oBd6KpysrscyHdZJaFNBIdmBKU93gu6giOJW21ZSl4TxOD/K9oahu+ITjZWWqfUE5+oVAzU9iaOCi+474KaIJ/JCMvmuHpYsp3prl2l5f94UDSmfoJjPrFHcGk5FI1zIecV/LINj0dTc1i+ANf5/PvVmRTzqt1Ju9/mPr+P/aCpwer8Wk/WDro7773enARu71S8nFFXWZy/oQFJpdE4zBpKhmv89frJDph5y/akRHVm8w5Og==;31:2ulLN/mONlq/o8FyAeTiwxBw9A4PkEKg8pg7MnE9zUiDJTrG2TFFrCVTYEo1uJM1H2aqN/va1TsBSpkr2Da+yq56AOaLgnUCGkeQHKgXf7ya09azGJy84lvKjCd2ptXJE9GXmxl14PuQlUqMgipbMbn5IG1Er4VQuIdqPvcfRJYBFawuAi0DH3IARhTasita1GruwzVhNFt0zlqoI1b9GnF8MnUAXIZAhZ7EQQgqeUI= X-MS-TrafficTypeDiagnostic: HE1P191MB0153: X-Microsoft-Exchange-Diagnostics: 1;HE1P191MB0153;20:0O5oIG51J961czyNxudGtyThQtSaq1SBfcfLjQe2E412HAtFElBNV0b1qvGs6ds9CEeH7PQAvxnSlayhifrCLsuoSELQwubmmHALv1otjtheYw8tnjXXnLclxh9VPdeSfU9jfo0e7QwxE+xphOTmwLiQv2gyy41XNpyOjgvTH8nY2lcHCtoIhkuUXb8d/sck0+jgG9ljg1yGvX1YazZEuRnrvK5uho0GfvLIGJEGnXtUoMNXhMa5e0lGJJKhkOJI8bUtqMyz7jUrFHuYnWp4+hxX6e+zCpVQMA92tDVarlHyGgx/pU3JbGMobvvE5nTLzUsS+00Ql1eA/RtcDi+cnQ==;4:a1BO9Zb6n87D8iYWyVkBbhwWxMmyxUF+LphJ7UtHomfEsxhRHVoRkdNObAz2BbDUe/o7G0wmRYV4FoYaClzbdWHLFVr6Eklr02etAGcM6uJUGAYgiU29bGQEQYfKO4nAxwmLMUFX+8NcGImf4JB0oQrr3qXTk99jRzMtp63iNtOl80dfPj/v3kRsSXicBerD636SGLnw7WYNhAmAGzbUDv9fBl/q5paC5zzWEWrSVX3xHc5Ft5E61CTYFiv3J38h01H8cfJlBVi4zAjFLh7/Dw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501075)(10201501046)(3002001)(93006095)(93001095)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011);SRVR:HE1P191MB0153;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:HE1P191MB0153; X-Forefront-PRVS: 0549E6FD50 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(346002)(376002)(366004)(39840400004)(396003)(39380400002)(189003)(199004)(24454002)(39060400002)(36756003)(106356001)(6486002)(4326008)(31686004)(1411001)(65956001)(229853002)(16526018)(65806001)(58126008)(316002)(66066001)(77096006)(6246003)(478600001)(47776003)(93886005)(65826007)(16576012)(5660300001)(53936002)(52146003)(83506002)(52116002)(8676002)(23676004)(2486003)(2906002)(64126003)(68736007)(76176011)(81156014)(81166006)(31696002)(386003)(7736002)(3846002)(6116002)(8936002)(6916009)(53546011)(105586002)(86362001)(305945005)(25786009)(97736004)(50466002)(6666003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XvEFKL5deLokoKCqYXcd/BQfINlqRxdfXCIvU2wxvgDwrFu5BcRxitZMKSrejeMvDM9gFNrdp6NgQu+wrx+Vkcg4QcSFMa29qfSBO2dkr45DHoaH5Dp/3JUuhL5wFs3nHRuUsqjoUkcmwJESwpu0EVnYUaI2wIalWePlTDNfkgQLD2M4SZJnI5t4ro SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sondrel.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2018 18:03:41.1559 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 10f7dbfd-01cf-4b26-0736-08d5591da5ef X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4faa3872-698e-4896-80ec-148b916cb1ba X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1P191MB0153 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 11/01/18 17:55, Nuno Gonçalves wrote: > So, for me clk_round_rate() always returns 24000000, and only the loop > variable i changes, so the search is monotonic, from the highest baud > to the lowest (increasing divider). > > I am using a Allwiner H2+, with the serial port configuration from > sunxi-h3-h5.dtsi. > > Are you sure that clk_round_rate can return differet values? Is that > because some boards might have several clock options beside the > adjustable divider? Yes I'm sure.  Some platforms allow the clock rate to be varied, hence the existence of clk_round_rate() and clk_set_rate(). > I really need to understand what is the problem, to be able to suggest > a solution to the integer overflow that is being allowed to happen. Some sort of overflow check on i * max_rate could work? > Thanks, > Nuno