Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2474486rdb; Wed, 4 Oct 2023 02:13:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHxhGonzFe5y5ucGe8AF0N61xa1IpZMsEyzmWeyZ8ZrkiILsvTTiMN1G3y8lljjA/UBN/uQ X-Received: by 2002:a05:6a20:2445:b0:14e:3ba7:2933 with SMTP id t5-20020a056a20244500b0014e3ba72933mr1847169pzc.54.1696410822165; Wed, 04 Oct 2023 02:13:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696410822; cv=none; d=google.com; s=arc-20160816; b=IX8BDJvb7nDewyfeS9QNwOh68rkltDs6JBVLSo8wn5mPbXKCUyhr4O8N3MkugIfb5s BX+eDYPD97gu4RKDQlHEHupUhsTksYOWeX0NnvfLenqGCntKU+pawX1nADsB9QbCJHj6 WgQRY8fFHmaj1tHdctbBFEGnBQKaw5iyrKO/TnE0E00SvE+gPDFstAHuhXePAAksDbfT y8a0FtKe9t92v6OfQkmGfYwhs+Z7arB1SJK6lOHow6d4V0X1ZmYhSEn74ddaeDyho3Q4 HY0Nki1N6A6k/7+GGjBFunkzdt8mIQM8ClTgZIjuMtZuELQdZzYuBfG3kaBKuiiK8cLV KLMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=DJgQq+/9asfoJflG0Tahk8eJ8/NVB9xxy0FGBrTlys0=; fh=vzs4DM2mWD8PfpMGlWsS6C5YnjZxZOklMqe3c3BEG2k=; b=V/jDKuVKltOnPLkAUbpI5Q1Cam5yCFnk0/ClxdYAtSko41BrjuSEVNNcj8GA6SAVWB POJItIrNSGYd+1jM0H/Rcv7/KzSVGCut5r4STi3zUFz1dB6rqligKW6qcKfD0RIXkma0 gX+OOE9CIx+lwLv8Ipop3lye3YQ1i/9/RJzU1WPdvUTpj2c0S0kaohkQ4GAPYoQvjzX1 gFaRsU4Zn/oD9+NqRx++daNTtdpRS9gmQex2ybi1k33QUZ1ydYr0moUFEXMU7+8lYAum MTKz0W8nwyPzs5Tl/7XwgTDIXOaB6neYGP/bx1SaOjEV5OSiSxzyALMzRz8fq+WGAfmJ fBsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iwgbZaEc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id x18-20020a056a00189200b0068a54e524d9si3467022pfh.150.2023.10.04.02.13.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 02:13:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iwgbZaEc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id E90D5806896D; Wed, 4 Oct 2023 02:13:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241946AbjJDJNc (ORCPT + 99 others); Wed, 4 Oct 2023 05:13:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232518AbjJDJNa (ORCPT ); Wed, 4 Oct 2023 05:13:30 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EA4C98; Wed, 4 Oct 2023 02:13:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696410807; x=1727946807; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=engroHUsDMpbS7kZWKn5ek1QdOf+4p0c/Cv494z9tME=; b=iwgbZaEcCL4EDdQ+DHlxAexvnMzvwQ1GuqJ8dbSrWXLNCq8xzMwSBtEY T9Xh1O2inNYpP3bRWObNYNNdIrzOedu2zoGbxA1eL5WGWnvXYjTOStys+ iUIl7ToXgsrArZT/gRVP1dZYeX2jMtBNAGDU8knZH+FOWVu51td+/SHRh hV6jVTtYkZmKfHUoTe1sX//S2QTuJohC4rG6YYD3NkJhSciewSXa4AoF6 TICTraRJfh1DpOIkCLSW5PKbQFr54RoFhbBNdsxJZfNAIaVgQEjOUl5gm nGBeKhb6e0n307K4d0+blgxoZifMI41LnOwV+S/JdE4Yy1faBjjqmn8wB A==; X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="469382303" X-IronPort-AV: E=Sophos;i="6.03,199,1694761200"; d="scan'208";a="469382303" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Oct 2023 02:13:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="894855817" X-IronPort-AV: E=Sophos;i="6.03,199,1694761200"; d="scan'208";a="894855817" Received: from cyrillet-mobl.ger.corp.intel.com ([10.252.55.203]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Oct 2023 02:11:58 -0700 Date: Wed, 4 Oct 2023 12:13:21 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Tony Lindgren cc: Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko , Dhruva Gole , John Ogness , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , LKML , linux-serial Subject: Re: [PATCH] serial: 8250: Check for valid console index In-Reply-To: <20231004090859.GF34982@atomide.com> Message-ID: <375d54d0-f874-92d5-91c5-c7ff2b33daff@linux.intel.com> References: <20231004085511.42645-1-tony@atomide.com> <1fc2dc1d-33f2-6d65-6bdb-d4c7421cbc57@linux.intel.com> <20231004090859.GF34982@atomide.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1096096951-1696410806=:1931" X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Wed, 04 Oct 2023 02:13:40 -0700 (PDT) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1096096951-1696410806=:1931 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Wed, 4 Oct 2023, Tony Lindgren wrote: > * Ilpo Järvinen [231004 09:05]: > > On Wed, 4 Oct 2023, Tony Lindgren wrote: > > > > > Let's not allow negative numbers for console index. > > > > > > Signed-off-by: Tony Lindgren > > > --- > > > drivers/tty/serial/8250/8250_core.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c > > > --- a/drivers/tty/serial/8250/8250_core.c > > > +++ b/drivers/tty/serial/8250/8250_core.c > > > @@ -611,7 +611,7 @@ static int univ8250_console_setup(struct console *co, char *options) > > > * if so, search for the first available port that does have > > > * console support. > > > */ > > > - if (co->index >= UART_NR) > > > + if (co->index < 0 || co->index >= UART_NR) > > > co->index = 0; > > > > The inconsistencies how different serial drivers handle this situation > > seem staggering. Perhaps there should be some effort to make the behavior > > uniform across them? > > Hmm yeah we should just have them all check for co->index < 0. Right but it's only about that, some return -Exx codes (more than one -Exx variant) and some do assign just 0 like here. -- i. --8323329-1096096951-1696410806=:1931--