From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 2E3C6423787 for ; Thu, 16 Jul 2026 13:13:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784207617; cv=none; b=IrATwe9UsMTVQWEmU8qv8V5qQLQxmJ34VFiMVtC4up8ZDFEPhLgKSev4tjWdmk9ll7qBqzMNDsO90drTvsCs7N9c3nl14Fxkr5LJn1SJDRO9dVjzPa4jHQmQNQmGkhTyAzq42jD52/ZoqKUWRxcpEZCi+EYTzAuBHU8SXcDJ0kU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784207617; c=relaxed/simple; bh=l2wYlPKoPn1wcA0Cb9ElP+k05wUzmXs20MA4PcGRH6s=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cDk8hZO79ViBDF+S2iCm/vfIZJDEhwpmuTl7scMW0W/0JYSX3kCRMfoX4Kl71w31wvKKXF7w3/CSR5Rgxe0Hf1WN0kBT6ZnnPpKC1YH6PYPlwxPWDbcPwAnsXzQFD+uG5NRnt77mrJUQzKLy2jq7ZNakQfLnQBNnNOd++yKaxG8= 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=MVfPK+/6; arc=none smtp.client-ip=209.85.221.54 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="MVfPK+/6" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-476a130c138so3205135f8f.0 for ; Thu, 16 Jul 2026 06:13:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1784207611; x=1784812411; 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=HP1xYRFn9L2tLIdTryxjblP9c+avAGhHub41HiA5F0c=; b=MVfPK+/6YTd6vcZs8xy/FLKtEO3u7xB+PsbiBnrF2NswNmCN8A1AddOG3+6C3y+6Tu agHUWPyRF3ycroZEEzu4fDGx97xKse8CffUIeM8wzSjGDhJgVmBeiww/cpd9O3DPyFQe YIvgqoSig3Im0JaKl/z9adHUG+nFCaUzUryW5mRTOX0mnPL+LM6y/zcIZ4JcclUYqqCG P6sM1oJtP/50nhhRbqzwOWEbldkpYdr3kOo39BwkRmISpRqmVQ1pDRVVlWm/gBclzE6U jjcgRVrjd6GnX+puMSwRexSsvrPIYN55xa4nJ9byTdpUnXiSUq+qyY+wCrHSz/6+ugs2 EbXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784207611; x=1784812411; 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=HP1xYRFn9L2tLIdTryxjblP9c+avAGhHub41HiA5F0c=; b=IsTCtYIsqKjXSgIHOSDzt4U6C3I4kddu1cJ9MZ83fn9yOEpLA49fJbi8DZT6Gxrbqt GTbxwDGz9VZN6Jylf6coxFoKqSdKw3Xh9AyaNSZx3M97zyE3POhYZ9wWjj99PGXXbLU/ j9p9lwgs9mg4cwrgshC4t+htEaVoSZkbp9Um1Bmhyj+S9fKn+/P/alkPKX1A5pqZ0a8+ j0OXKTdFykhFm7bhhoZ4/66jy3HqBBIGTqopF08SJryj6rLs3HCrVHLmmOFto4fnbbUr 7wZDQ6sTyQnNFAsTSva5TLXfc4SZP1U1iP34c2vCtLm08x2yQs8HnFK0gXprS1pR8qCf 4PVQ== X-Forwarded-Encrypted: i=1; AHgh+Rrbz3jAKUm4XAk547W1L+R+PM0CBL5kqUFqg76IupHCDEw3GhZc+WMWysZCGjO5KdyMEkSIcT40ZtMtVnE=@vger.kernel.org X-Gm-Message-State: AOJu0YyAOJXYv5IIzLdadl3+Zbxh3Zt6zjCfnA7D8ca3L5tJ6ejIQ36U s8rsPRDdrSdQ22YE/wSYsSRClchVk41Fm+I2+OjUzf73FX9ygISX01h+DW7t7EAEUd4= X-Gm-Gg: AfdE7ckQKyk+IdnIrX93cNhSUzXUg40KrHAoq8LvjOMXxA37ZkDLgmk4XvMBG9VjQR/ V3kon9SZIX7RMZxqj1u3E21z6GWhuVS0z42baNtYIpSRXvPvvaSIPJ/EKcGnQZR+BPWECSPF8j/ 57GQFGHkvpnroCNnGZv1fkSh/lYxyw0OVgoHDjjE2mV/F7xoQqqAgErY7BvuVIoZsjfETlXKw3d bIee7S+4GTPu0u6yyBKOYz2TQKmrnZu+FXT5Z4Mw77U0P0NuzsH+V6JXZJpcDW3wKKvnIwviU+/ ubqZcXuM8+G2qRknQgBu5Vy71nIFSwz2rRvxsf0hHES1SUpP0VQ34rmEgfFahbwIbYDkPVEXbRB iTqzjKMEz2yyV2sy9cfu0smkXZhNw6tCfpHyLEQYmQ0YPOOFBNnVkmQYs0k+DJYKRuS3JdppnwO ZnPj8k X-Received: by 2002:a05:600c:4ed2:b0:495:3c8c:c16a with SMTP id 5b1f17b1804b1-49541248d08mr37275695e9.0.1784207611203; Thu, 16 Jul 2026 06:13:31 -0700 (PDT) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4953c7006dfsm90819375e9.1.2026.07.16.06.13.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2026 06:13:29 -0700 (PDT) Date: Thu, 16 Jul 2026 15:13:27 +0200 From: Petr Mladek To: Andrew Murray Cc: Steven Rostedt , John Ogness , Sergey Senozhatsky , Jonathan Corbet , Shuah Khan , Russell King , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Andrew Morton , Greg Kroah-Hartman , Sebastian Andrzej Siewior , Clark Williams , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-rt-devel@lists.linux.dev Subject: Re: [PATCH v3 2/6] printk: add bounds checking to boot_delay Message-ID: References: <20260712-printkcleanup-v3-0-574547b8f71b@thegoodpenguin.co.uk> <20260712-printkcleanup-v3-2-574547b8f71b@thegoodpenguin.co.uk> 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: <20260712-printkcleanup-v3-2-574547b8f71b@thegoodpenguin.co.uk> On Sun 2026-07-12 11:20:33, Andrew Murray wrote: > As the boot_delay kernel parameter represents a duration in > milliseconds, let's set its type to be unsigned int and add > bounds checking. > > Please note that the existing pr_debug will only be displayed > when boot_delay is non-zero: > > pr_debug("printk_delay: %u, preset_lpj: %ld, lpj: %lu, " > "HZ: %d, loops_per_msec: %llu\n", > printk_delay_msec, preset_lpj, lpj, HZ, loops_per_msec); > > Signed-off-by: Andrew Murray > --- > kernel/printk/printk.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > index 31aabdf8248cc39c54ee11685d4a37deac1c174c..8be562c9be277670ba3209ed1f810fc87175848a 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -1291,19 +1291,22 @@ static bool suppress_message_printing(int level) > > #ifdef CONFIG_BOOT_PRINTK_DELAY > > -static int boot_delay; /* msecs delay after each printk during bootup */ > +static unsigned int boot_delay; /* msecs delay after each printk during bootup */ > static unsigned long long loops_per_msec; /* based on boot_delay */ > > static int __init boot_delay_setup(char *str) > { > unsigned long lpj; > + int boot_delay_val; As Sashiko AI pointed out [1], the variable should get initialized: int boot_delay_val = 0; get_option() keeps the original (random) value, for example, when the given string is empty. [1] https://sashiko.dev/#/patchset/20260712-printkcleanup-v3-0-574547b8f71b%40thegoodpenguin.co.uk > lpj = preset_lpj ? preset_lpj : 1000000; /* some guess */ > loops_per_msec = (unsigned long long)lpj / 1000 * HZ; > > - get_option(&str, &boot_delay); > - if (boot_delay > 10 * 1000) > - boot_delay = 0; > + get_option(&str, &boot_delay_val); > + if (boot_delay_val < 0 || boot_delay_val > 10 * 1000) > + return 0; > + > + boot_delay = (unsigned int)boot_delay_val; > > pr_debug("boot_delay: %u, preset_lpj: %ld, lpj: %lu, " > "HZ: %d, loops_per_msec: %llu\n", The problem gets fixed in 4th patch. But should fix it here as well to do not break bisection. Also later changes might get reverted from other reasons, ... With the initialized variable: Reviewed-by: Petr Mladek Best Regards, Petr