From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA86438910C for ; Mon, 27 Apr 2026 08:18:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777277886; cv=none; b=GNEuXehY/rnKEJwzp+JN++NckeTpGdBjLVBegp0EHOtbI83xAk2Uk0sJEzTkg97Djwt8fvKetd5ZZjYECq6xDSEK6sfGdbLtNakWzfXvqld2HRVH36pTZtHsJcHnF6KJlp18VRfBuZ+IPYDoiIA0EjLbjoxDZdWduChm8vL40wU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777277886; c=relaxed/simple; bh=aiNvVEZjD0y1jLU+yDMEyDTjGz5ROQQX5wGjTgRWuCU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oP2hTIY1hwsDwOtLSNQwSxnaSG9Lhkr5tLuVkvWa7SjktyBgyoq7VVMWqVqj/J0qXH3eP15ROntnMDJYLi6RaP6fvlSEfcXSEC0YW2Tij25TuanmmtWhnDiy8mL5P8QuhgEIB287Hs6gWigswd1VFrtzJifuW7AMhBmlx5N3mLk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=vjvJIE9B; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="vjvJIE9B" Date: Mon, 27 Apr 2026 10:17:58 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1777277882; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VXEca9wZxHuIJHBJHP6oxDqiK57cgwjB3CuO2ga/DGg=; b=vjvJIE9BCjw/9bOD+rIE6utM2JWRyjSscKhoTj8zo+jOViWzu5EbEjv1sXX3OW+MNao5hj PaEoxPCLe+4WyER1s/b+IMA6DMykTXBwJecwVBsQmXh+0HyzBEMKTlYeemPNXL1g6OiCDd DIXbVdeedNVq94bQuG0eEySyNnfjkyM= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Thorsten Blum To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Changyuan Lyu , Andrew Morton , Alexander Graf , "Mike Rapoport (Microsoft)" Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] x86/boot/compressed: use boot_kstrtoul() for hugepages= parsing Message-ID: References: <20260409161600.152012-2-thorsten.blum@linux.dev> 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: <20260409161600.152012-2-thorsten.blum@linux.dev> X-Migadu-Flow: FLOW_OUT On Thu, Apr 09, 2026 at 06:15:59PM +0200, Thorsten Blum wrote: > Replace simple_strtoull() with boot_kstrtoul() for parsing the > hugepages= boot parameter. > > Unlike simple_strtoull(), boot_kstrtoul() performs strict validation and > returns an error on invalid inputs instead of silently accepting partial > input. Use boot_kstrtoul() to reject and warn about invalid hugepages= > values. > > boot_kstrtoul() also converts the input directly to an unsigned long and > avoids implicit casting. > > Signed-off-by: Thorsten Blum > --- > Changes in v2: > - Adjust warning message (Boris) > - The value pointer cannot be NULL after [1] has been applied (Boris) > - Update patch subject and description > - Link to v1: https://lore.kernel.org/lkml/20260202173223.865709-1-thorsten.blum@linux.dev/ > > [1] https://lore.kernel.org/lkml/20260409105437.108686-4-thorsten.blum@linux.dev/ > --- > arch/x86/boot/compressed/kaslr.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c > index 3b0948ad449f..8e4bf5365ac6 100644 > --- a/arch/x86/boot/compressed/kaslr.c > +++ b/arch/x86/boot/compressed/kaslr.c > @@ -219,7 +219,8 @@ static void parse_gb_huge_pages(char *param, char *val) > > if (!strcmp(param, "hugepages") && gbpage_sz) { > p = val; > - max_gb_huge_pages = simple_strtoull(p, &p, 0); > + if (boot_kstrtoul(p, 0, &max_gb_huge_pages)) > + warn("Failed to parse hugepages= boot parameter\n"); > return; > } > } Hi Boris, Could you give this another look now that [1] is in mainline and 'val' can no longer be NULL? Thanks, Thorsten