Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B13AB3E6DD0 for ; Fri, 17 Jul 2026 09:47:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784281633; cv=none; b=RaiBP38hcoVj4dLDeURYdbB8GAIAxbM1w8ewVu3rZ2zLUU07mJAn4Ac4K9RWW1vXdhxPn09qM6WreX0MKUsAK0/QOPkwqM74DNehLtp164UqgULAEBzcwsFDD66g7KRHmzrS3VM77b9GdmVkXbhqCWDNmvZRGgYdXqVSWXaV51w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784281633; c=relaxed/simple; bh=fBFKgXvtq8JDeN2ViQ+fO02RrPBGnfhIYCJPQ+RPSvA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=X+h1F3DBSAHH7i/zZwnqWO4SZnZBX1PTKqbwJ5n/rE9EYqswq3bxc/2tWvAo4gaEVbnJSLMeqRWEqgDMKbEjs2dHEpoJTUn8N3S7Qh2/gDFqKONLoenTFnp/f8z18AtaOUCVWm2nlQvFtqSpsIC6u+B1ct/zyH1mHHrxvwGp8ps= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=Cfw4Hwh5; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="Cfw4Hwh5" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-493f60208a5so63526225e9.3 for ; Fri, 17 Jul 2026 02:47:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1784281630; x=1784886430; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=rjPhdBVDPXatdjSpLTt7BAp9vOYuOBnz5GyIfUTPA5g=; b=Cfw4Hwh50Fr2zhgD0w8zCtHsF+1Eu4z0T/4lJBgxWn81GsZ9IiX+U3rEjidTyITOGt SO5w+tPnMpScsnCz4f4vCbOTxbK6IJB8IaXzSgHmz0bmFhazvKLXB2l57tOFGqkRXw6x q5wY5hs5UBDuVoFtTbIpK0u/5pkNV3wK24WVdEZABBY6DMGX1XQsDy2kEiO7k/J6bqt5 FdusgIpZ7RStn/alaub2Xw+KxDf1hhpY08U4W+Uq+v5vJTHdTszT8Sem9AmPuk1xbgLB D9ZEmKAICO3ZU+uujUuBNquZxl+QuKbDvkjSqe4bo+s5ZTq5PfoCWHwBcVvKFo77n0rp iypA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784281630; x=1784886430; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=rjPhdBVDPXatdjSpLTt7BAp9vOYuOBnz5GyIfUTPA5g=; b=TUVgvNlwkdPT/kUnuDHkRckx3QHU36XCyP7twx+HNHOcQI3XEmX2fYl5NlIX3GjWJK B8s4FrW9ptdk+CrNXcTDe8vNYXGGWKaaIA8Vu65Q3Hz9rMUSGQalSXQlLt8Zb6RJJl/p M0g9B7nVA6T7QvGbH38qzRgs5efo/mpV2yFPBF/O6JWhlWfVFKfJ6l+TFeQu7U3TyixP zNB6N7Ogg6h+veqDAL17cQ/viqmJ9ednjEiJcKCZ4EZS/0kY0wvq1AnJrLEQVU0pXxt4 Jhqtx3EFouPAjr9hOvZEzRqNBEQGmXblYRbggp0962iaIMErFDZfsmo3Zwi9m1uhHB3H AUFA== X-Forwarded-Encrypted: i=1; AHgh+RoIfNQH/cWTyCgfZ2kquE4DvIk8cybc8RJoEsxVsd6iJjE8HK3C/CdYLfN7qdKF+iRk5xRgJvyjEmRbdb4=@vger.kernel.org X-Gm-Message-State: AOJu0YylhTWfktR9aZoXohXdguoi1D2bW6C/abbqAy2wj+jxebLfr3ql A4wOMK1qCbC/VttE1+6VTM53uPDOKGdC5Ri3kyFNJ1LXBOwjrukBZ5FfOj4SVMkT/zw= X-Gm-Gg: AfdE7clsEAHgQdqJv4mTueiLhDjJWkoCtPEdf3hXBs6GYAYRjOZGFsSGi1RMY5PDJBN G/fIo3ziXOki/Vtlbv9rNq6oBn1xrCo1iM9jQPWSQRexpyjg5H9BEfgtCsTmTF1ro0ZNzimDPrz nN9YhnGMG1s8PKFHGr49yuNOzjURODy3RUIWQFp2zL7ZnxBnmoTAQ8G0tUTltuGsj6I/hELImyy SxJUn/YkZMjNrCSV5wykoJGDQFYVaLYWqVjmWvl1EugAbblnDGpdulmQ6StcY8aXOCVF2etAm80 29cFv7pfLfLlzurZ4tQ3lmiAxYyNApScjSpnnJBOuTEtxMnn7GTD06R7iGy3w8Sz2EBX09CwTXA KKoDUxYQS6BpShF+Uu1tsQ7edR6UBaxDbJcNRujwkn2EPerMtVBNa3EmPNV3MOZih75QnBdC96r mFd3a9NwURFC8Gk7Y= X-Received: by 2002:a05:600c:4593:b0:495:3a52:cd7e with SMTP id 5b1f17b1804b1-4954a40e2f3mr21141725e9.25.1784281629234; Fri, 17 Jul 2026 02:47:09 -0700 (PDT) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49549c96ff7sm35616035e9.10.2026.07.17.02.47.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2026 02:47:08 -0700 (PDT) Date: Fri, 17 Jul 2026 11:47:07 +0200 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Marcos Paulo de Souza , Chris Down , Naveen Kumar Chaudhary , linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 01/11] printk: Handle pre-enabled consoles in the top-level register_console() Message-ID: References: <20260604101459.393162-1-pmladek@suse.com> <20260604101459.393162-2-pmladek@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260604101459.393162-2-pmladek@suse.com> On Thu 2026-06-04 12:14:48, Petr Mladek wrote: > The function try_enable_preferred_console() currently has the > non-obvious side effect of returning success for consoles that are > already pre-enabled. This obscures the logic flow during console > registration. > > Move the check for pre-enabled consoles directly into the top-level > register_console(). This change makes the handling of pre-enabled > consoles explicit and easier to follow. > > Furthermore, this separation lays the groundwork for future cleanups > where try_enable_preferred_console() can be restricted to cases where > an entry actually exists in the console_cmdline[] array. > > Also it fixes a possible out-of-bound access when the console_cmdline[] > array is full and no console matched. In fact, the check of > c->user_specified did not make much sense. The new console either > matched and was handled in the for-cycle. Or it did not match > and then *c pointed to an unused entry. > > Possible behavior change: > > try_enable_preferred_console() will newly be called also with > @user_specified parameter set to "false" when it failed with the "true" > variant. But it looks like the right way to do. It will allow to call > newcon->setup() when the console was preferred by some platform > specific code. > > Reported-by: Naveen Kumar Chaudhary # out-of-bound access > Closes: https://lore.kernel.org/r/7sq4tr2nmlz32tvkf6vpsghv6exvqfghsrlvywjcqihzsqqbf7@bspclmti5xg4 > Signed-off-by: Petr Mladek JFYI, this particular patch has been pushed into printk/linux.git, branch for-7.3-console-registration-cleanup. I want to get it in rather sooner than later because it fixes a potential out-of-bound access. The rest of the patchset needs more love. Best Regards, Petr