From patchwork Sat Oct 14 10:49:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vamshi Gajjela X-Patchwork-Id: 152926 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp2411172vqb; Sat, 14 Oct 2023 03:50:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEVj+hkQy4PfbZUk09tyldWLpiZhxsmGERRBJZ8GNiixpcJDIFjaCk36Z7cOiNglSeLIUbL X-Received: by 2002:a17:902:ce86:b0:1c4:2b71:7dc9 with SMTP id f6-20020a170902ce8600b001c42b717dc9mr32846373plg.4.1697280626375; Sat, 14 Oct 2023 03:50:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697280626; cv=none; d=google.com; s=arc-20160816; b=OCWarsN3VSQqZZcYmaFW2yJ8t5iIskgqGD/EcBVSlIqjfiSRf932iY7t/yYBy4wtgX /WQbPe2B/KencVZvnTmt11hUxd7FscO1DbOa1A9r05suibfroyUdjj2wTrsWeUa7k4Vt GyiG0MRZPHzP9prtXGnBbH1B40Cw6m51UgPOnZ1KAG7SkvZc8H7e0zIJasgF22hzoPwD TeH2SrWB+EuX+6yWiqX6PHdavepog0CYD6kLGuroGYCppeQFyRGfdsJWNMz16kybQHQq ZCKtrq+6/TP9iCRncSvQhPoRKanSAHSRNeOKjPYSgoOKfCpc2blS+nOrhnHoCgk2s9zv dtfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=rhmpXagUV1Eroi8NsqxMkQ7rrh98dWj1q7PH6sEyJW0=; fh=4iPUH3SCaUeHRPwZInlqPLZI8cmh/b74OgcORLvvuVM=; b=a19panFrekT5vBllRaEdOQmKzRUbtPknfq1eS+1OppxEVJ2Abp3JcPDGxxBKbvXJsB AwzyI8XRdp6fKcqLqOLDtlHLFMWuWskyc0Ys8S3u+4sixw27yJA9e1Ek7IwRGe2DRw6J gXbcVkHymVAN4ibyrlthDEFrmj166zNiLpAev1g//EDnp/9UeOdO5kVKGU3rrWlPcPaU jvTo46O2VaQJ50R6VB8ay1xhjZhdfs+qyT7+J0eLlqrkQZPrrxhEaGGRSJr6DgV3V/Dz M1cG+aegEvfzBd1m7FW2H1iOKqC6KkudCaaImXUKrYBNgUmRr0Fxc8sVNC0pWX9xcGLc Y0UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=wcNgefQ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id c23-20020a170902b69700b001b674055d72si6179048pls.621.2023.10.14.03.50.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Oct 2023 03:50:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=wcNgefQ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 696D3802DA93; Sat, 14 Oct 2023 03:50:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233126AbjJNKuF (ORCPT + 20 others); Sat, 14 Oct 2023 06:50:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233104AbjJNKuD (ORCPT ); Sat, 14 Oct 2023 06:50:03 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C273AA2 for ; Sat, 14 Oct 2023 03:50:01 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-59b5a586da6so22474137b3.1 for ; Sat, 14 Oct 2023 03:50:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697280601; x=1697885401; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=rhmpXagUV1Eroi8NsqxMkQ7rrh98dWj1q7PH6sEyJW0=; b=wcNgefQ4O/Qa+X1vZ1a6Prnxsn9zQBeunBJaQVtybAUSD8Ps2zSAkmGhgoLYdg1Znm MBHVq+P9Hfg0Ib/V59SJqAPgIGvaDLmsx70bCwly+H9Ackta0hUpZh/u4lY3tqQT1enm 7v23y44PpSgJ6aKqzw1kDF4fJZ63fEkKeIy8YePGLs4ynhRQU80+NLd0qPdQAZ840esq WzPgKxEMgxNdPlW6FW9apro65szce1bKLo3cPshn5D4rJSkHRiAFFHrshRTmWwRn3hsT f9PHGjyVLLywrlKJTJJupeiNl3peIEdWhzUGz18819QmQMP6Le8w8R9ZL0znau7WGThl AJpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697280601; x=1697885401; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rhmpXagUV1Eroi8NsqxMkQ7rrh98dWj1q7PH6sEyJW0=; b=Voo9oPiuazxX4aQmojKiYY1j4mRGfKcgIX9PA//P5oXtuxaWm4RVh6AEchSBHC5fni 8Ad41tS2bZ2t/VXWmhQIjU/D4J0HPffYw+AfuLHjReTU7iMkXRVkBmgdnx4lCzfQpCQW 1Gj9MQakhPxLRBBgdVkNv3wtlP8oW/bGJbmJosLBDc2EiWEoGN8yF5mjwweeJ+B7Ad2u FskOIA4qgOC/q0fURemb8XXW/GBvymmBF5/cokO3MvFNdpu40J3Ikv0Vau5FV0rsI7tC TaYrr54JxDs2vSZiTi0aQX24uCz5lWvgu5OLCZyHywDqE0eDb0UQUYo4wZX3GmtgcIrs C2WA== X-Gm-Message-State: AOJu0YyRTQ2RDSQCfDC3KWYpr5mKCfkGOYw9v5wScmEdXyhbP5mLLQzx PxtfclwKvnaqZJR0DVmZLcJb+UZURQLWJuNjnvxl X-Received: from vamshig51.c.googlers.com ([fda3:e722:ac3:cc00:3:22c1:c0a8:70c]) (user=vamshigajjela job=sendgmr) by 2002:a05:690c:368b:b0:5a7:a731:3360 with SMTP id fu11-20020a05690c368b00b005a7a7313360mr88331ywb.2.1697280601060; Sat, 14 Oct 2023 03:50:01 -0700 (PDT) Date: Sat, 14 Oct 2023 16:19:40 +0530 In-Reply-To: <20231014104942.856152-1-vamshigajjela@google.com> Mime-Version: 1.0 References: <20231014104942.856152-1-vamshigajjela@google.com> X-Mailer: git-send-email 2.42.0.655.g421f12c284-goog Message-ID: <20231014104942.856152-2-vamshigajjela@google.com> Subject: [PATCH 1/3] serial: core: Potential overflow of frame_time From: Vamshi Gajjela To: Greg Kroah-Hartman , Jiri Slaby , ilpo.jarvinen@linux.intel.com Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, manugautam@google.com, Subhash Jadavani , Channa Kadabi , VAMSHI GAJJELA X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 14 Oct 2023 03:50:25 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779727730342289364 X-GMAIL-MSGID: 1779727730342289364 From: VAMSHI GAJJELA uart_update_timeout() sets a u64 value to an unsigned int frame_time. While it can be cast to u32 before assignment, there's a specific case where frame_time is cast to u64. Since frame_time consistently participates in u64 arithmetic, its data type is converted to u64 to eliminate the need for explicit casting. Signed-off-by: VAMSHI GAJJELA NACKED-by: Ilpo Järvinen --- include/linux/serial_core.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index bb6f073bc159..b128513b009a 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -558,7 +558,7 @@ struct uart_port { bool hw_stopped; /* sw-assisted CTS flow state */ unsigned int mctrl; /* current modem ctrl settings */ - unsigned int frame_time; /* frame timing in ns */ + unsigned long frame_time; /* frame timing in ns */ unsigned int type; /* port type */ const struct uart_ops *ops; unsigned int custom_divisor; @@ -764,7 +764,7 @@ unsigned int uart_get_divisor(struct uart_port *port, unsigned int baud); */ static inline unsigned long uart_fifo_timeout(struct uart_port *port) { - u64 fifo_timeout = (u64)READ_ONCE(port->frame_time) * port->fifosize; + u64 fifo_timeout = READ_ONCE(port->frame_time) * port->fifosize; /* Add .02 seconds of slop */ fifo_timeout += 20 * NSEC_PER_MSEC; From patchwork Sat Oct 14 10:49:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vamshi Gajjela X-Patchwork-Id: 152928 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp2411255vqb; Sat, 14 Oct 2023 03:50:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9WPkNNFyFo/mJX12u1LLGFIj9BXDCy5og3sRq+9wKN+TyvlOHbTEWUvKRWZehKbhvJo+R X-Received: by 2002:a17:903:22cc:b0:1b8:2ba0:c9a8 with SMTP id y12-20020a17090322cc00b001b82ba0c9a8mr32039469plg.2.1697280641914; Sat, 14 Oct 2023 03:50:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697280641; cv=none; d=google.com; s=arc-20160816; b=Zidxi8DcBEyQ6A/F+eNHreohHyzfDzAdeEQBoSWR+EMeyW3MxbKbKS3vk1YBLdGIb7 0c1OokCX5/VssxONEIqCGpzAU8pB48yzym8e4KvuOXfnB80rUNJQ1Ga5cnmdk7V8fEpr 1AU9HUW76Onlk/D2NUnnO3i2bNw2ls5QFSSNYmAFifq/tyQo42dGr84MQSCPv0uo+GnX exhAB4y0yvPB4UxeotEMFNZvAh5ae4jsyx0ZpuCRiCX9qR0P+lxNNCDzNzdolXEl3ThE aJBGgR0aNdpNft0mTd1Ahf+RvUaxBza5atix/En4LqYF/BToT8+GwsuB45fgSpLDUwfP +tLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=I0MUXgCgPp7gRv8+WcNEgYQP5+7MSeABFPYxMKK1EzU=; fh=4iPUH3SCaUeHRPwZInlqPLZI8cmh/b74OgcORLvvuVM=; b=xtHrnOqkEkQEaQ+6OYzk+sH2jxE9gqD7PdPtP72HCOBkMSH0TD3QFUmWZ5984XiV1K kXJnkSE8MOfdJFRO6rz60KjSwS0VtChHhhlOws7ffWdDtvxDMYsX0EMIYrrpZG4+IYiB OgwhsmcC2H6EU5DO9Ult0CKzulr2xNp/RjlnJzYH6D1QKmzsO+sjjugHiuCf8YvSjntd x+gCogaJi0WEMFyzp1hwRomZ2M8nSgVQ+WNV3Ew9M5kHUUWxnKyWA6jXVELsmArscFPg QcixQCmFNHkAbCOCzWKH5zAacLejQjI7DDvQuV3CfySI5pjJZmXCS7HbupaNmwx6i0KS eljw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=FL36Pbjd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id x8-20020a170902ec8800b001b9be39eaa8si6956214plg.348.2023.10.14.03.50.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Oct 2023 03:50:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=FL36Pbjd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id D527B8131C03; Sat, 14 Oct 2023 03:50:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233157AbjJNKuQ (ORCPT + 20 others); Sat, 14 Oct 2023 06:50:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233190AbjJNKuN (ORCPT ); Sat, 14 Oct 2023 06:50:13 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81CE7FC for ; Sat, 14 Oct 2023 03:50:10 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-5a21c283542so46577907b3.3 for ; Sat, 14 Oct 2023 03:50:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697280609; x=1697885409; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=I0MUXgCgPp7gRv8+WcNEgYQP5+7MSeABFPYxMKK1EzU=; b=FL36PbjdncuCHtvIiTjirmj8Y1uHygRUSEiSeK5NjGaW8kAni8c6BvB7VTxYgtO3GY mzzL1GlB7/TlqO/jV99WqnBvAt8nm1wBKYUwLZz1CiBCeD/oT8HQWTgtWKW0wzTNaqvM MKEh7aczALaYKVEMwOMq4hIrfdhPorxcAyvMV61i5+CCOIO86PbJG7EfkpWplE4GWkle 3OHU1MyjtgDDdxc5GH6Uc7vOcMd7xT+w8Rm9gB733C0nYG1qf4YLn9jd9Eut/37YdaDG Lp7rlqLFOgoQ2pCRBuJMDkkNl+Fq8u1V0c9MLt3/+gP7odqA/QMl4AOSsUXYnHb9jmrK 5u6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697280609; x=1697885409; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=I0MUXgCgPp7gRv8+WcNEgYQP5+7MSeABFPYxMKK1EzU=; b=An8pw9e4FLTs01edXEoTirVQXY4HiS8DJ9hSJQsHIj7maEte+oSjvoa80S5VLKDRZh ryYXcJdIPlItK2220SOo0uHxNDvuJdqawRVHLy9xScis90IsJjaJTfm8UQoBHI6etU2A FlF7f2DEWvPT34e41MQoaESG0lb0XkE8CnpTTnwmnI7OCn4gZOmQhltMhjtSHLlI4zU4 tViOiqtxzpC3ORmD30uPIZxAAZ2m5zCeio9/SI01+4b8Mj7XAZmuPLGCNN3qI/aWtgc1 5k0eh+rUpAZzlp4F2+s8EggbcmkOZunq76RVh1xwOWHdQtYjCLGFsfMIpS2F5VqKDQ7e QudA== X-Gm-Message-State: AOJu0YxT2Kgc2+iEMyLNDwchcJ+PGHrMN7pyFR72U2VKy/sHNsYXIE/6 WULqxA6rlyIzEMekXe8OTVLYGML5jl9mHxYHrBTR X-Received: from vamshig51.c.googlers.com ([fda3:e722:ac3:cc00:3:22c1:c0a8:70c]) (user=vamshigajjela job=sendgmr) by 2002:a05:690c:4086:b0:5a4:f657:36d9 with SMTP id gb6-20020a05690c408600b005a4f65736d9mr522763ywb.9.1697280609769; Sat, 14 Oct 2023 03:50:09 -0700 (PDT) Date: Sat, 14 Oct 2023 16:19:41 +0530 In-Reply-To: <20231014104942.856152-1-vamshigajjela@google.com> Mime-Version: 1.0 References: <20231014104942.856152-1-vamshigajjela@google.com> X-Mailer: git-send-email 2.42.0.655.g421f12c284-goog Message-ID: <20231014104942.856152-3-vamshigajjela@google.com> Subject: [PATCH 2/3] serial: core: Make local variable size to u64 From: Vamshi Gajjela To: Greg Kroah-Hartman , Jiri Slaby , ilpo.jarvinen@linux.intel.com Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, manugautam@google.com, Subhash Jadavani , Channa Kadabi , VAMSHI GAJJELA X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Sat, 14 Oct 2023 03:50:39 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779727746279746147 X-GMAIL-MSGID: 1779727746279746147 From: VAMSHI GAJJELA The variable size has been changed from u32 to u64 to accommodate a larger range of values without the need for explicit typecasting. Signed-off-by: VAMSHI GAJJELA --- drivers/tty/serial/serial_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 7bdc21d5e13b..fb4696d17a8b 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -410,10 +410,10 @@ void uart_update_timeout(struct uart_port *port, unsigned int cflag, unsigned int baud) { - unsigned int size = tty_get_frame_size(cflag); + u64 size = tty_get_frame_size(cflag); u64 frame_time; - frame_time = (u64)size * NSEC_PER_SEC; + frame_time = size * NSEC_PER_SEC; port->frame_time = DIV64_U64_ROUND_UP(frame_time, baud); } EXPORT_SYMBOL(uart_update_timeout); From patchwork Sat Oct 14 10:49:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vamshi Gajjela X-Patchwork-Id: 152927 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp2411199vqb; Sat, 14 Oct 2023 03:50:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHJrQKOL7I7tsoFP8fOrAhs1BbNWy1xqYYdBJdcIuIInnqdA+DBZO4QaLLXJqL+pyVxXP9+ X-Received: by 2002:a92:dcce:0:b0:351:54db:c1bb with SMTP id b14-20020a92dcce000000b0035154dbc1bbmr28448380ilr.0.1697280631417; Sat, 14 Oct 2023 03:50:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697280631; cv=none; d=google.com; s=arc-20160816; b=peUKKsjoyA5iuKIGcPr8IPjWX13I/dVlA9+08M1XEI5qjkr1w1be49pwRqghROEbtv IHzvbjgZbiC2CYozkwGdvO8MZY8AClu6TXeCd5yEF/W7GV4HhHvyrQ6j8uLcHiC4airm liS1xXSTHIoBopDARSDh6Cs3sxoLPRLI5yCgRmEqVd/D5yL9c5fzMEXNlcKdxsdFxsxn /EY5Plnjx2SxcTe3x17Rvp1Pmo9yJNxjKOA9ZZkAh9Yjukpq6kxiPI/iVw2cMVKcxnmF lzws/lZrKpjEWdJV4fdiys1kziEgAJu16X+8vUWTyHZ5UCW1lc1+VUrxBIqdMbywg4Za PAsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=ZYCXn3ElgcmgyYLbM76CHob0tkZSwXwvOlTaEhXB7SM=; fh=4iPUH3SCaUeHRPwZInlqPLZI8cmh/b74OgcORLvvuVM=; b=uRBDBRiCInQBtYugaaf7GHmKdeWLgJ04QkPyalEt/Pllxf5cElUvqCoolnVLhantVR 3puJS5Ig7d/0qidNOsxrfKVY0tQuZolmSiVt6yAdFnlBae4vQvAI5JWzcrlHkvuc7Xkv +ucdYzwMYLEnfDJ9oFqETW193Ce0arcZpO+HFy1kcsdX8Wm6c3Qj6SGfxanRKFn5O3PV w0FOkM83BZ17Bx4BRCf5ljd9sZ8RcPMq8WsxUbQZ+EDGhJAKJa6EJ8uY7xrzU6FfdjCL guTDc6XFPPaEqzpEq3iVVOJkmIFXmR10vsr/SoM+l39d5wZ2wbl/eUuFlEsBdmP6zu2Y dLSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=etTkr53J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ce15-20020a056a002a0f00b0068a54522bb0si4119101pfb.144.2023.10.14.03.50.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Oct 2023 03:50:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=etTkr53J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D857E802DD00; Sat, 14 Oct 2023 03:50:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233109AbjJNKuX (ORCPT + 20 others); Sat, 14 Oct 2023 06:50:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233144AbjJNKuR (ORCPT ); Sat, 14 Oct 2023 06:50:17 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC104DC for ; Sat, 14 Oct 2023 03:50:15 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d9a60a104b6so3442602276.1 for ; Sat, 14 Oct 2023 03:50:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697280615; x=1697885415; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ZYCXn3ElgcmgyYLbM76CHob0tkZSwXwvOlTaEhXB7SM=; b=etTkr53JSOwwe+9PYrUPt0fKjQzkeRwQurPJYvFu50+iJS82nIAp2OZH0BGPIDKSte wzXIM+FLJpCsDRsWttk2BJWWujVK9/25j6b156OUkm048163j6yefEzyTrg+qveQQYqC 3Qg07eYL9toqsF4l6ffl3K25Mz18P4/JFfUWjSnYCIzmHmLINxv2WZ8o9kgb76HyQLDt p2sMbBJWwGReTttyu+gJPJc5DmMCGzClQWa+oimYx2iFZ1taBk2haJvLSKb5zS4qQKQO X1o6zQ93FKkn8PEDfJDF+d0DzMp4Y9SD0YAS3aCq9erFGKfAnMhDXYBPKmjat7aCtStn sxUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697280615; x=1697885415; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZYCXn3ElgcmgyYLbM76CHob0tkZSwXwvOlTaEhXB7SM=; b=QXty7BfR8A1B3N5FoE0N2ZwphWOWIQxzMMU9JBFtbMbM/Fcfd2mWU2zyCFqNfB5k4J t047yxCxE6a+7sCjhbeoHz5vsF+e0qbJWmZeGJug+WVjrvZVQKAtR5ZCN+mUPFE1+Q7A QHsHm/b3ByV2K/teIvwRn60X5O1TZ1LevuQE+IxfjzXRHd5L8k6qQ5D2aEf14Lssye9O fnHFVcTWfGaIMRQWcN3ae58vdUbDtnWi5wusLf2c5eSKChtlRSCz/igaMY56dOeQdztN XBbOF3a5aj6y3EI0cEauv4eIl6oiMLIZqDC2klMs//xryeB0gIONTGnbDoOK09VIE8C3 EuTw== X-Gm-Message-State: AOJu0Yx711c1AVl7CuX0a3TrxGJK9FDGLGQOBLr3w5YOJwOlo73aWhCw UG19ZB89GUrd2FkC+eXwXgEWUKGIXqvKwWy58qHX X-Received: from vamshig51.c.googlers.com ([fda3:e722:ac3:cc00:3:22c1:c0a8:70c]) (user=vamshigajjela job=sendgmr) by 2002:a25:aa83:0:b0:d8a:fcdb:d670 with SMTP id t3-20020a25aa83000000b00d8afcdbd670mr78496ybi.1.1697280615084; Sat, 14 Oct 2023 03:50:15 -0700 (PDT) Date: Sat, 14 Oct 2023 16:19:42 +0530 In-Reply-To: <20231014104942.856152-1-vamshigajjela@google.com> Mime-Version: 1.0 References: <20231014104942.856152-1-vamshigajjela@google.com> X-Mailer: git-send-email 2.42.0.655.g421f12c284-goog Message-ID: <20231014104942.856152-4-vamshigajjela@google.com> Subject: [PATCH 3/3] serial: core: Update uart_poll_timeout function to return unsigned int From: Vamshi Gajjela To: Greg Kroah-Hartman , Jiri Slaby , ilpo.jarvinen@linux.intel.com Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, manugautam@google.com, Subhash Jadavani , Channa Kadabi , VAMSHI GAJJELA X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 14 Oct 2023 03:50:29 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779727735328279644 X-GMAIL-MSGID: 1779727735328279644 From: VAMSHI GAJJELA uart_fifo_timeout() returns unsigned value, hence the function uart_poll_timeout has been modified to use an unsigned int type for timeout values instead of a signed int. The return type of the function has been changed from int to unsigned int for consistency with the type of timeout values. The result of uart_fifo_timeout() is cast to u32, indicating that the value is truncated. Signed-off-by: VAMSHI GAJJELA --- include/linux/serial_core.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index b128513b009a..445a1ff7e502 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -773,9 +773,9 @@ static inline unsigned long uart_fifo_timeout(struct uart_port *port) } /* Base timer interval for polling */ -static inline int uart_poll_timeout(struct uart_port *port) +static inline unsigned int uart_poll_timeout(struct uart_port *port) { - int timeout = uart_fifo_timeout(port); + unsigned int timeout = (u32)uart_fifo_timeout(port); return timeout > 6 ? (timeout / 2 - 2) : 1; }