Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp635964rdg; Wed, 11 Oct 2023 00:34:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHCaQIqO/2WDMa/1cFaK7KzVc0eDn9BAwrgarUKxT3uk7b9ochrsLQo29ATK9xSRkirjDNT X-Received: by 2002:a25:1fc5:0:b0:d9a:5338:5572 with SMTP id f188-20020a251fc5000000b00d9a53385572mr4181252ybf.40.1697009658729; Wed, 11 Oct 2023 00:34:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697009658; cv=none; d=google.com; s=arc-20160816; b=KsIS1ZcWe54P7uSGBMpDRKXMWEO4PILTkMnVCQqrVrE0IsqgNFW7yNnP7ed0v3sXnM 7UVlDf7SR94f4yyYS36ZLOvbp/ujgn5E/X/nbKYv4TiKkXFmVETCUTfUyzQ/F1NZ2XPB u/n2rAewdCMto27jVzZDK9c6nsMT+0AB/PYOVQ+zOh9euEetPiqYZbK3TcGcSYq4gcLM lSBVf91aa9CNxWgKlqd+gKmP+biDS9DaHm+CnODvWbYTFgmbVpnUMd3jUEN4rOIre3I1 daq08zqOr+avBdGoya0QmkXuiiIIq/g/Tb0bheY5mqLGWTCmIDE6zauhUMYk1NMF5BHp 1Y2Q== 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=YDqXT+96J3M+V6BPp+qVLgEPr3A2PrOHrHm58DKi6sY=; fh=58ImmVCuFle95JFvhXW8TMFJHv6YLSLeJPpTl3/7Lp8=; b=fBUtp+RNfEGhhwz8n/XN1saPAw5tYu+YocQNhYEKnxZX+eAyQzjKotZsfT6Y+Lj/BK haM7Fe07/gvi2a+TFwiG1dZrElJJRAyiQZC9s8wCICiuCqRRpwa813AuUlQfgPUQAWML FlEcdHNkeD2eNg8ZfHVTkWcfurgb45HZMmpM+QuVAKTgvDmw5QHL8w3crrBA2mh5sltd K+vkFjZHk868EZAfiXqxndouE+WbRsRoXgW2xMTyZnMNKQqXh0lwnZ85TIGu4mSFgJrc 1PawgY8n4iHuAD6VznRHJwQ4o+WnkwFir2EblrygG6ZV44jGpT4ICH8HWo1o2RNj4VUV /O7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id s69-20020a637748000000b0059bdf5a4ecfsi3277417pgc.247.2023.10.11.00.34.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 00:34:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 F059281A6E43; Wed, 11 Oct 2023 00:34:16 -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 S1345164AbjJKHeL (ORCPT + 99 others); Wed, 11 Oct 2023 03:34:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345040AbjJKHeI (ORCPT ); Wed, 11 Oct 2023 03:34:08 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 876AF91 for ; Wed, 11 Oct 2023 00:34:07 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 0154880E1; Wed, 11 Oct 2023 07:34:06 +0000 (UTC) Date: Wed, 11 Oct 2023 10:34:05 +0300 From: Tony Lindgren To: Petr Mladek , Steven Rostedt , John Ogness , Sergey Senozhatsky Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] printk: Check valid console index for preferred console Message-ID: <20231011073405.GB34982@atomide.com> References: <20231004085434.42570-1-tony@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231004085434.42570-1-tony@atomide.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, 11 Oct 2023 00:34:17 -0700 (PDT) * Tony Lindgren [700101 02:00]: > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -2410,6 +2410,10 @@ static int __add_preferred_console(char *name, int idx, char *options, > struct console_cmdline *c; > int i; > > + /* See struct console */ > + if (idx > SHRT_MAX) > + return -EINVAL; > + We can just use const short idx for preferred console and return an error for negative values for preferred console. I'll send out v2 patch. Regards, Tony