Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754347AbeAOL2C (ORCPT + 1 other); Mon, 15 Jan 2018 06:28:02 -0500 Received: from mail-eopbgr20041.outbound.protection.outlook.com ([40.107.2.41]:47568 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752633AbeAOL17 (ORCPT ); Mon, 15 Jan 2018 06:27:59 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ed.blake@sondrel.com; Subject: Re: [PATCH] serial: 8250_dw: Avoid overflow in dw8250_set_termios To: =?UTF-8?Q?Nuno_Gon=c3=a7alves?= Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org References: <20180112134507.9030-1-ed.blake@sondrel.com> From: Ed Blake Message-ID: <0433bf6f-e8e3-4050-fb54-20b6c764c5c1@sondrel.com> Date: Mon, 15 Jan 2018 11:27:54 +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: LO2P265CA0004.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:62::16) To AM4P191MB0148.EURP191.PROD.OUTLOOK.COM (2603:10a6:200:66::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 87241e58-e25b-4718-ae53-08d55c0b065c X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603307)(7153060)(7193020);SRVR:AM4P191MB0148; X-Microsoft-Exchange-Diagnostics: 1;AM4P191MB0148;3:WsiCxUemW65DF0rRXbiIFkR70itvFu8qjxn0erAdJbZS3Am3mXDqSKwEfA1ghkUGXpCGlKfnneMqmI/Ci2fytTj2IyWqVlsyc2ObxevW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/HCxzmw7TxHrd8kwrLET/PxXM0sNhsVymsexd2tCCsVCB64hcG8yS9zLHPN4g0sPAwJs+Q==;4:7FAIUOZMvD1MiP6SBQK12gRn9HT1b5buTa+Z953QesFUMtp2TN3E8FJDjHv9PBXChp3xpkUz6Y13ndEfMjKf+91FgNXVDDxPAxnOMxJXE4XvfjVaXgeKBU3hINAv+Q8gX5HWHdM60PEI7tBNATYIWZZKYfjU4hPcF8Yd5DCqzuC6C4Mv2IxNBEjmBm153Pfo2qSpZqw3VkkDB7leVE2esoWH1yjfPgX6v741cBhD40ZGKAtP8g2S3+xi0mb6s6g317RS3W3GszeAQKig6dOGMssCIs4BJNbrCIaTxJMANuamA2ftDyhcoZK734qiVoVO X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85827821059158); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(8121501046)(5005006)(10201501046)(3231023)(944501161)(3002001)(93006095)(93001095)(6041268)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(6072148)(201708071742011);SRVR:AM4P191MB0148;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:AM4P191MB0148; X-Forefront-PRVS: 0553CBB77A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(366004)(39840400004)(396003)(39380400002)(346002)(376002)(189003)(24454002)(199004)(2870700001)(76176011)(59450400001)(39060400002)(478600001)(77096006)(229853002)(25786009)(81156014)(6916009)(58126008)(81166006)(105586002)(386003)(5660300001)(97736004)(2950100002)(6246003)(50466002)(52146003)(8676002)(2906002)(2486003)(53936002)(6116002)(3846002)(4326008)(23676004)(53546011)(52116002)(413944005)(65826007)(68736007)(6486002)(16576012)(86362001)(106356001)(15760500003)(31696002)(36756003)(83506002)(16526018)(8936002)(7736002)(316002)(305945005)(47776003)(65806001)(65956001)(64126003)(31686004)(66066001)(1411001);DIR:OUT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P3tY=;7:ZAgOEvBU+87ZxpsZDbi/RPUXxBTpW6IHxpUYeIqSqLAm5cgipLyd6evch/QB+9eF22js8c3bCTpVhw/qdWilGHtxfK+PSgySylM7O9s76vMr5e9GP+fBVt8BFsVM5Pj4+j/JZQELHQpF67DXIO8k0qcrtiyYkgXRomF+bNt8gNjwKssRrEK9ZigxVX+sVhdnYCeDmQuj6U6X/AuhgDi0KLFEVMQ+8MTWZDJ4El1HRvRXVP90+ut1BNLQrYH/Z1zo SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sondrel.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2018 11:27:56.2676 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 87241e58-e25b-4718-ae53-08d55c0b065c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4faa3872-698e-4896-80ec-148b916cb1ba X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4P191MB0148 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 13/01/18 11:59, Nuno Gonçalves wrote: > Dear Ed, > > Thanks. > > Tested-by: Nuno Goncalves > > I just would like to report a aditional issue I find, which I am not > sure if it is intend behaviour or not. If I set bauds 1152000, > 1500000, 2000000, 2500000, 3000000, I always get a actually set baud > of 1500000, because it appears to be the closest baud by my hardware, > but if I set 3500000, then the port gets disabled. > > This is because up to 3000000 the closest integer divider is 1, but > then it becomes 0, which is invalid. > > If we still should return the closest baud, then we must return a > minimum of 1, and never 0, at uart_get_divisor, or > serial8250_get_divisor. > > Thanks, > Nuno Yes, returning a divisor of zero doesn't sound very sensible.  Care to submit a patch? -- Ed