From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE1F4CD98F6 for ; Wed, 11 Oct 2023 07:34:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345161AbjJKHeM (ORCPT ); Wed, 11 Oct 2023 03:34:12 -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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * 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