Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2471623rdb; Wed, 4 Oct 2023 02:06:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHos9XLg5SqsJOu9VHUH+muYQA94RhIvWKMkP2bDqajcBenlIyXkM81duqfxFILBPxWa4R X-Received: by 2002:a17:90b:1058:b0:277:3565:30cf with SMTP id gq24-20020a17090b105800b00277356530cfmr7756036pjb.6.1696410400127; Wed, 04 Oct 2023 02:06:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696410400; cv=none; d=google.com; s=arc-20160816; b=lm8BLXNvT/Tyzs/w+TxDkLXpjRkfTuBtmU5EIZx9KeMe6ntulOaFamZYeWdeQIJbkJ xBmgzE4Rf8FD6kQ7N5EbhUAVlBmefR6n4zQtJwVFBH5dWphnI5IP/HCE6LXE8UThPQG/ ctYoCZHbdrcnkJwb+Xj4JJ3Ycvjooj0C7+JEnFveFnBxY1PJvhAZeJ/YF+M0RtmJRn46 vAAG7c/ssDPqWlVlRCOpBl6550wJ38mazezH5/quAPZ4t62A6j4A/3kSs3jLg0GIDvOT 038aqznZjD90vd/BDsnrZ7pCj0gfzOAVrN6vKicKcYHez1uvoBushTATaJiVzn1glfIK 2QFA== 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=P0JmJV3/vdEuOdaSyHyiTxIw+egIf7IyOgHoYGlGDs4=; fh=vzs4DM2mWD8PfpMGlWsS6C5YnjZxZOklMqe3c3BEG2k=; b=htiDYWU8CKrTV8EjE7P/yQpSnkuFxWwUGCKzcOB8aSf5CRhrrkTs1HAST7GbATAbTq +tJI/CezTaRVaYUXmi/N3eqbMQW5zPnAZWlBnQlZU3tW39NnED2HhCxtSfzfjmrYJpZo xW/sOM+SNFQg6EDs6HEmoW/A0yU04VRttyBg+fD/cMiVmzqZOctjo2oOu8gOX01wRgWp e3Pnms2ags/iowfidhXVGEivNcyyMPLXWZXnkwm95NIF0WJksgKm60HV2aMkAgIgfnUx 8N4UAWP3foYvg7I313grKHUK+eQ1UtTXx+fW//wRT20uGopzV+8jHfqvObudhjJ1GPR7 7dGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PRYrE4Y1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id m10-20020a17090a71ca00b0026934bf746bsi1067023pjs.62.2023.10.04.02.06.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 02:06:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PRYrE4Y1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 941B180B6325; Wed, 4 Oct 2023 02:06:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241941AbjJDJGF (ORCPT + 99 others); Wed, 4 Oct 2023 05:06:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241910AbjJDJFw (ORCPT ); Wed, 4 Oct 2023 05:05:52 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D0D2F4; Wed, 4 Oct 2023 02:05:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696410342; x=1727946342; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=TuSBtMiLTwOnYSwHDKjzTnmtHNlxvtFoBDS51b++/4w=; b=PRYrE4Y1Y/m86hN8qkap8onWEBgZHsMWITvehV5I7Mn1beSSAeRAFfws 3+tllcAtp0VIeBx6K165sHqGafEpEzCQ87INn4vMk5NLnnwR5F6R8fipt zilVPC95OMWowMLeEtFvMlktBHO49Rcb+zQ8QFVB63nNtvMBEG0l6q6Fg IOGgCVY6rktMIlFm9d1Gq6QsKfan+vXfK/i4PZxjXCdZLgWUv4uonoikA C3wdmYqbf1siWAplYJ4hE4ljIlz74ekDeENO/zoH0JXltu7+/uAX776Yr AIPfzCHuJkfB09V2GqkXeseDO3Rz7AGfO+nfQIWTo4+3uxPnWka2nzp7h Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="381970906" X-IronPort-AV: E=Sophos;i="6.03,199,1694761200"; d="scan'208";a="381970906" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Oct 2023 02:05:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="786427644" X-IronPort-AV: E=Sophos;i="6.03,199,1694761200"; d="scan'208";a="786427644" Received: from cyrillet-mobl.ger.corp.intel.com ([10.252.55.203]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Oct 2023 02:05:37 -0700 Date: Wed, 4 Oct 2023 12:05:35 +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: <20231004085511.42645-1-tony@atomide.com> Message-ID: <1fc2dc1d-33f2-6d65-6bdb-d4c7421cbc57@linux.intel.com> References: <20231004085511.42645-1-tony@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED 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 (howler.vger.email [0.0.0.0]); Wed, 04 Oct 2023 02:06:19 -0700 (PDT) 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? -- i.