Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933698AbeALNde (ORCPT + 1 other); Fri, 12 Jan 2018 08:33:34 -0500 Received: from mail-eopbgr10072.outbound.protection.outlook.com ([40.107.1.72]:46233 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933573AbeALNdb (ORCPT ); Fri, 12 Jan 2018 08:33:31 -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 From: Ed Blake 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> <4fc98be4-e489-20f0-d899-e5eabdbd5e9d@sondrel.com> Message-ID: <48ee75ee-2d3a-c299-4ed8-23eb9ea27666@sondrel.com> Date: Fri, 12 Jan 2018 13:33:22 +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: <4fc98be4-e489-20f0-d899-e5eabdbd5e9d@sondrel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [195.88.9.101] X-ClientProxiedBy: VI1PR08CA0102.eurprd08.prod.outlook.com (2603:10a6:800:d3::28) To HE1P191MB0155.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:c6::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e436e71e-d49c-4dba-f56d-08d559c10fd7 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020082)(4652020)(5600026)(4604075)(2017052603307)(7153060)(7193020);SRVR:HE1P191MB0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pksm+IbF4Ox+R2Qdb/g70AjGIpHOf75Nz3i92u56P207gtYoU0u/vsqCAVH6U9lgsGPanutrHSDRTrX1xoxdA6c9NHYATLHAg1vCHXYZgI3vZv5idp2KE6x4imVxM/MsWar/rmX7mqzkSdyDtBwiXy9RU3YuNSL7nTzM+QRM+lpvRx2vQWGrLzbt0sWeSaW9Ie+gTnf8oNQi/Qs6ShnBLeJqXuRAg==;4:BQ74mWxrEfEONWxZ6Rj/aQiIYSmEin7wTB59FVhqisOsI5/HDL7+hSM+CfQVYyJcVtHBWzmfcjlpVo3XWjuied9/AcgxU6uARP8XR3VEgnCoeFrVZ/84ji5ArMaJv9rMyWowmD7jfXWXv+EzZZUiZFoC7lr41EcCpvFVF87jOOdTXt/24ZrdN3FLZ40GV9e1fYo5qUJf4Krj+bq97IgjdeHnj7PHdcVdQy77jd6PwM+Ayp/PFOFsQyHJFx3q4xAhXRb+5uwUrMpR7TqrdsxOEg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(5005006)(8121501046)(3231023)(944501144)(10201501046)(3002001)(93006095)(93001095)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(6072148)(201708071742011);SRVR:HE1P191MB0155;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:HE1P191MB0155; X-Forefront-PRVS: 0550778858 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(346002)(39380400002)(366004)(376002)(39840400004)(396003)(24454002)(199004)(189003)(229853002)(2870700001)(6486002)(68736007)(31686004)(65956001)(53936002)(76176011)(83506002)(31696002)(47776003)(64126003)(105586002)(8676002)(66066001)(77096006)(81166006)(58126008)(316002)(65806001)(16526018)(1411001)(8936002)(106356001)(81156014)(16576012)(478600001)(53546011)(6246003)(5660300001)(97736004)(93886005)(50466002)(305945005)(25786009)(2906002)(39060400002)(52116002)(4326008)(6666003)(65826007)(6916009)(386003)(3846002)(23676004)(2486003)(7736002)(2950100002)(36756003)(52146003)(6116002)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1P191MB0155;H:[10.40.8.37];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtIRTFQMTkxTUIwMTU1OzIzOnFhcEd6R2ppaE0rV0RKcFZTSzB6SjIvMHBh?= =?utf-8?B?VGdiRHdTc3YxeWUrYjZ5WUhjQklJL3Rtam1vUURYMDcvUUhaeExBWXhzTFRY?= =?utf-8?B?bHFXZEozNngvbU1yYThZby9hOHI0SDhObmJpMDV5R3FSa2l1NDZMbGgrbU81?= =?utf-8?B?Skp4NTF2Mk9NRDNkMW41TnU3cmMvZXUvOHFxYW55d2NsM2xMMEpJd0RoYUdC?= =?utf-8?B?RGJmSy9kMG5tK1Z1SDJkMDZDd3VCV3NzRXA5bjZzcjhRN2U2MUJlN0Y3L1Iy?= =?utf-8?B?Q2Y3VS9Hcm93UFo2WGdGMGxvTi8rMlB0VVc0UTQyVUliMFJyV21aT2JIYTda?= =?utf-8?B?Zjc5ZnA5MXRRVjRyd3Vhbk11K0pDQzJ6UnRzWGJFckkxTEJaei9jUDNnekg5?= =?utf-8?B?cWNsMVloWGlKWFBBcExJdHJBcnVvVy9ZdlZXdk0yZmVFU2NpMHFzMFI5b3J6?= =?utf-8?B?ZXVzV1kvU3U1QnRoa1FVdUpPa0NReGJMajNkUEJVaDZyb0hlbWU1OXhmcXNE?= =?utf-8?B?b05jMmtNYmtaeGlzV3FreGk3a1I4SmdBdTlMQ1F0Q0Mvc0ZlZVZqREYxN1ow?= =?utf-8?B?cUV0NGFCMDlBQkhWd2IxeDM5cDlvbk50VHJWZWowdkNYMytWNGpnSDJkNGxP?= =?utf-8?B?aWhlcDVqU2k3QnVtMUtlSUJhSE1rbUJ1TWxzLzdYTXo0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te5Kh+Ifh7OchpKMZbfC6xcJJsfaOtD5w=;7:zJkUCwx/elNJvnNHAwzULKuiNrn60I6W5/+SV8unrsWpjhKiZX8DofM7rNX1e/RPO3NljkxpUEqocD5y0cfI1f2Ta5QwhAIIabeZrX28W+M0OlBE8VeLeEk0eo6zv7H/4NWBLowOJ1MmVqmlgtt7lc7DxU2ky4TSM3HzwvP4Verg6wserz9o7waKVUO3ZngICYyG72cD2LauyeGtHluU/aKu0Z6d+qMSlfC9mpH9uCHvZvDxN8A8FKT6aoZDOa7q SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sondrel.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2018 13:33:26.6539 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e436e71e-d49c-4dba-f56d-08d559c10fd7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4faa3872-698e-4896-80ec-148b916cb1ba X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1P191MB0155 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 11/01/18 18:03, Ed Blake wrote: > 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? Actually I have another suggestion.  I'll submit a separate patch. -- Ed