Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp106908rdg; Wed, 11 Oct 2023 23:26:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEtksueZsrfdue0ZLOb0kkshT6pkOHv6AOGbfvnUgVrg2lPDBCTSlE4zhaTZ8o5tDJgHott X-Received: by 2002:a05:6a20:4323:b0:16b:b4a0:e06b with SMTP id h35-20020a056a20432300b0016bb4a0e06bmr17399566pzk.43.1697091961834; Wed, 11 Oct 2023 23:26:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697091961; cv=none; d=google.com; s=arc-20160816; b=WoMHGcdJWYG/QfFfECF+aILZrkoM4OTsFLWv/HO4ZL4WsZKxnsjukbXByOLct25M/S 1oWii2cF6/db2nFdR6EGXe6F0yXTLWMw25m6maVMJk7HuYrnSOtkxWBruHECfhmO5Tkk q3GOUDWAQR/rSYQpcGkk+6AUiiCOEjb/wjOX9Pi/xh0SGWKumJ6sF6ffRU4Dm/t8HS1P 2ORYAP8i1ykxZM64NIdFs/lfPiu1/s3v0Dvod7MURQJ+/gVpg2CLe0jCB97Z0xJo8l/p Ug1bXdtPcHr/fe9LEw4yfAOdRdRHIvRsVtfnbiRNR5xoWo/zNQ/Gmvyh9N/F4a/5I4kM KXkQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=+NA1mWspFUKtvdrE5UKkX4wxfMrPUIjCDckxZFWUdXM=; fh=tHp7CA/ck7cyo8Ve/m8SghfjohIYEzOW/CC6JxSPr3k=; b=W+oV2FT3/OvW9utegU6a1s2iGLvyCcfpcT7rYxdkLbNsjgiNtskaba6n6VyVu0qLKD PsgreRjC4IvCNeh6NDGo0VDbZGl1okabGR2XWrEzlK36S6LRQ66ttQkr2wWs4sTf3WYc NRSypG7JngLKYevxO5ohhafjzwAwSG4a36Fyc61SDy0SklCiy32NVFToUKClJg2PooAD Vf/a7mG52bYiDgIxfcCC9/cu4G+kfbLn20xp5lJMZEiwbAwUS7zTDiBnMm1BoFz5gwUT 7mAma99aWKugwR3ZpkhoursElDDgQ0F+ojTWWWBXv1rFd0Znb0935xxA81qw3mRHxpxD HpKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id r14-20020a17090a454e00b0027b4d1ee2c6si1575751pjm.144.2023.10.11.23.26.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 23:26:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 97D47807D420; Wed, 11 Oct 2023 23:25:51 -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 S1377684AbjJLGZi (ORCPT + 99 others); Thu, 12 Oct 2023 02:25:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377474AbjJLGZR (ORCPT ); Thu, 12 Oct 2023 02:25:17 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A6A22121 for ; Wed, 11 Oct 2023 23:24:50 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id BE20980E1; Thu, 12 Oct 2023 06:24:49 +0000 (UTC) Date: Thu, 12 Oct 2023 09:24:48 +0300 From: Tony Lindgren To: Jiri Slaby Cc: Greg Kroah-Hartman , Petr Mladek , Steven Rostedt , John Ogness , Sergey Senozhatsky , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] printk: Check valid console index for preferred console Message-ID: <20231012062448.GF34982@atomide.com> References: <20231011074330.14487-1-tony@atomide.com> <18944d40-321a-46b2-b97c-a8c3f98daccd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18944d40-321a-46b2-b97c-a8c3f98daccd@kernel.org> X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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]); Wed, 11 Oct 2023 23:25:52 -0700 (PDT) * Jiri Slaby [231012 05:54]: > On 11. 10. 23, 9:43, Tony Lindgren wrote: > > Let's check for valid console index values to avoid bogus console index > > numbers from kernel command line. While struct console uses short for > > index, and negative index values are used by some device drivers, we do > > not want to allow negative values for preferred console. > > > > Let's change the idx to short to match struct console, and return an error > > on negative values. And let's also constify idx while at it. > > > > Signed-off-by: Tony Lindgren > ... > > --- a/kernel/printk/printk.c > > +++ b/kernel/printk/printk.c > > @@ -2404,12 +2404,19 @@ static void set_user_specified(struct console_cmdline *c, bool user_specified) > > console_set_on_cmdline = 1; > > } > > -static int __add_preferred_console(char *name, int idx, char *options, > > +static int __add_preferred_console(const char *name, const short idx, char *options, > > This "const char *name" change is somehow not related to 1/2, but to 2/2, I > suppose. Thanks I just noticed that too, that sneaked in while I was resolving a merge conflict while changing the order of the two patches. Regards, Tony