From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-183.mta1.migadu.com (out-183.mta1.migadu.com [95.215.58.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 5C5772E1F06 for ; Mon, 2 Mar 2026 11:12:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772449935; cv=none; b=qh6HBCaeiYHZ3TC3p4RarPkILZTIplASi4jK7OfjnBDYtkBrDQV0jpyTt9CAGZjaVBxITSGG3yL1lm6RJhidKDIBSRM2WZTJCyfOY/Fhy2gP769pOcM/4D1Ar9zkcwkE+S+vNp3RbPzgEnuehWW4lChZTsi2UEzkycdQ2qL3tn8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772449935; c=relaxed/simple; bh=GM+Z9UVNW9FI3pvI+cXlI6/ipj+fNxuLx1+9oGzp9MU=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=jrvt3i2LK4eLqKu1CwVvvJnCAnYkvE9+d102jYgveHLWoyIHQnuDJTTvV8D/i10DoApKu+wJyk7P42fpiYT9alpLL3sQxk2v/xHZE95sa8/j9EAawYagMikzzTOOFTl3FfjAEvdmGabSXe4roSp4EZ9vRV3hKSMur02cP7vLRYA= 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=oOTtDWjU; arc=none smtp.client-ip=95.215.58.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="oOTtDWjU" Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772449932; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GM+Z9UVNW9FI3pvI+cXlI6/ipj+fNxuLx1+9oGzp9MU=; b=oOTtDWjUD9VeIscBnE9nbfCF8tyJUjrU9i43ihNOCdKzDKvu8Icpejuwb0d/n2QbghMCfC pWyAoLjigTvkEJ+Ds+qCXnMxz4PbcAXKCvhNXUbhnC3o1QQ0qh5kaDSrx6L1JwM6CMRsfw 9ESdxWSDlPeEwMhwFynRQmipI/Pnt9w= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81.1.4\)) Subject: Re: [PATCH RESEND] x86/boot: Replace simple_strtoull in parse_gb_huge_pages X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Thorsten Blum In-Reply-To: <20260301183012.3a12ea7f@pumpkin> Date: Mon, 2 Mar 2026 12:12:02 +0100 Cc: Borislav Petkov , Thomas Gleixner , Ingo Molnar , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Changyuan Lyu , Alexander Graf , Andrew Morton , "Mike Rapoport (Microsoft)" , linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <01CBB333-424E-4A43-B7F7-B540C35BF1EA@linux.dev> References: <20260202173223.865709-1-thorsten.blum@linux.dev> <20260301104454.GBaaQYpia9Kcul6bbo@fat_crate.local> <20260301183012.3a12ea7f@pumpkin> To: David Laight X-Migadu-Flow: FLOW_OUT On 1. Mar 2026, at 19:30, David Laight wrote: > On Sun, 1 Mar 2026 11:44:54 +0100 Borislav Petkov wrote: >> On Mon, Feb 02, 2026 at 06:32:20PM +0100, Thorsten Blum wrote: >>> Replace simple_strtoull() with the recommended boot_kstrtoul() for >>> parsing the 'hugepages=3D' boot parameter. Unlike simple_strtoull(), = which >>> returns an unsigned long long, boot_kstrtoul() converts the string >>> directly to an unsigned long and avoids implicit casting. =20 >>=20 >> "The respective kstrtol(), kstrtoll(), kstrtoul(), and kstrtoull() = functions >> tend to be the correct replacements, though note that those require = the string >> to be NUL or newline terminated." >>=20 >> Where are we making sure of that? >>=20 >>> Check the return value of boot_kstrtoul() and warn about invalid = values. >>>=20 >>> Signed-off-by: Thorsten Blum >>> --- >>> arch/x86/boot/compressed/kaslr.c | 3 ++- >>> 1 file changed, 2 insertions(+), 1 deletion(-) >>> [...] >>=20 >> Make that >>=20 >> warn("Failed to parse hugepages=3D boot parameter\n"); >=20 > I'd suggest including the 'val' that failed to parse. warn() isn't variadic and cannot print format arguments. We could add another helper (e.g., warn_param()) or use error_putstr() manually, but I'm not sure it's worth it for this case. Any other thoughts on this? Thanks, Thorsten