Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2472719rdb; Wed, 4 Oct 2023 02:09:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFxXmK5l0htCzGz0ypA37vsx44Lp5NJ6tWWN6yihDr/gJUwe9tZ/sCaWVW9Zzx5uiIwA7YL X-Received: by 2002:a05:6a20:d403:b0:15e:ab6:6e24 with SMTP id il3-20020a056a20d40300b0015e0ab66e24mr1516940pzb.27.1696410550184; Wed, 04 Oct 2023 02:09:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696410550; cv=none; d=google.com; s=arc-20160816; b=qR2bOlktDam4kDZRxK6Ud39McVq4nRpc2GJop7ZNI5q5O7ahmn130Wz+0/XiiJ1VDi /IH6315a3H1jha2MzrSm08oMRWmAlVzq4TvLy+pV2u2mbIv8WdXLrqVMiuJy3jOxqiR1 BPjwDln55jndHHSzqAKr8O45jIo8GVE2K+tNHEOY+ajyku0NgC5nCA+GJg8zs/PcNVjM 2f8ocn+dxJSuArT7PFHXzCfJXB8ikMbEgsdQtD4nxSC2Szmlb1gDIz6LB2hxdumOxzMI kKuxI5+kC98d6HEmq56WW3hL3Wm5yjtW6WecWZPSgnKSHmQnVTNtnvE8vr4fDxTPAzVU n52g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=WvL0CeZ3H2Yl2K3rWMHoff+1KVJWM/ja329ECe9031w=; fh=4LMwDg9iDtsRgrORVjX5sXAX+/NhtFQsb9g5eBe+3KY=; b=Mh8vFq231DrGhTh3F+Uczxs914EOalofFw7oq7K/x+M0YCKl4ya4rvZSukp9vrzctR xwcUUppAID78ZywTyntdSgIWUQPQaJ/iO99Il322DNAkW/FJpbzE6AbNzw4fGfHMaZc9 10GEb0N0+8pSqrlRxYNrwuoWaD/FSzZddzQKv9COccETIKqvf+i+nQls3QlW94yPeQxt hFS3jGHz4C+pwBro2yxspdi8qO6/eLkyOb6MqqB3S43xdaKn146caAks/Q02SkD7kj4p KzWwh5MkttqoDmCSC7NTKORDIfk2pCpJ4qKxDlb6RXWhwWgOuhzEo17hujVCTOQW7JrK XCzg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id h128-20020a636c86000000b00573ed0023e1si3301733pgc.333.2023.10.04.02.09.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 02:09:10 -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; 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 Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 43C84804C531; Wed, 4 Oct 2023 02:09:09 -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 S241922AbjJDJJH (ORCPT + 99 others); Wed, 4 Oct 2023 05:09:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241920AbjJDJJE (ORCPT ); Wed, 4 Oct 2023 05:09:04 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CABEDAD; Wed, 4 Oct 2023 02:09:01 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id D833A80BD; Wed, 4 Oct 2023 09:09:00 +0000 (UTC) Date: Wed, 4 Oct 2023 12:08:59 +0300 From: Tony Lindgren To: Ilpo =?utf-8?B?SsOkcnZpbmVu?= 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 Message-ID: <20231004090859.GF34982@atomide.com> References: <20231004085511.42645-1-tony@atomide.com> <1fc2dc1d-33f2-6d65-6bdb-d4c7421cbc57@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1fc2dc1d-33f2-6d65-6bdb-d4c7421cbc57@linux.intel.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE 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]); Wed, 04 Oct 2023 02:09:09 -0700 (PDT) * 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. Regards, Tony