From nobody Tue Dec 2 01:06:10 2025 Received: from out-186.mta0.migadu.com (out-186.mta0.migadu.com [91.218.175.186]) (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 B30B87081F for ; Sat, 22 Nov 2025 11:46:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.186 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763811975; cv=none; b=FoI8DlAw5eTWeXO/ekN2b4P3GMofGuf3/aKyomP66BgJPj1lRy1nRNQIRy/D1/A1fojd+QPco9uH/s4qGgEa2ZA+UOTjwYvJLoU4GUSkIA1Bo5HCyrB0QONj0aTEScV0uvtALt/HRno+EnOhQODqv85kn5tyciY7CssBoB7XO7w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763811975; c=relaxed/simple; bh=cNl6bjULokGz4WkJRllUZOM17L9wUK7cBBopTZD2pSQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MRH3u3CfDYnXwXcsCCIxp0THB4IvMhCZ/ODpKI1tFH3drVXKgVzzbAGpHWiLX4K5itVC2uWx9BMYdLUkL/TOHnwNVcQHC+Km1dGYNUkZqpnrJy8/2s8yt0axnGmAyUofXD6sPEqaDLYtrqWyw9TjrDqAmzxqDph4rmIMIkzT2XU= 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=NxVT+b21; arc=none smtp.client-ip=91.218.175.186 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="NxVT+b21" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1763811971; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=gWCb+LSAEfAZ8VeK6KP3kbOv3XlQvpUZlpzvkIjixO0=; b=NxVT+b211B1V9pOlfdpkE7ZjB76GNJL44c7De9N5cnqHOGZkZ47SOlVcmOmy5prefp/j59 zHGA5GST7Dg+JJuihJ+RNSES/fe/Ki+CzDOszg5SamakDxJFCSfh4vFc38VYy4YIlYCkYH lt+Z0QwJ7+nAcUP/0OGeHbwOIF/ppk8= From: Thorsten Blum To: Christian Brauner , Andrew Morton , Peter Zijlstra Cc: Thorsten Blum , linux-kernel@vger.kernel.org Subject: [PATCH RESEND] init: Replace simple_strtoul with kstrtoul to improve lpj_setup Date: Sat, 22 Nov 2025 12:45:37 +0100 Message-ID: <20251122114539.446937-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-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Replace simple_strtoul() with the recommended kstrtoul() for parsing the 'lpj=3D' boot parameter. Check the return value of kstrtoul() and reject invalid values. This adds error handling while preserving existing behavior for valid values, and removes use of the deprecated simple_strtoul() helper. Signed-off-by: Thorsten Blum --- init/calibrate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init/calibrate.c b/init/calibrate.c index f3831272f113..09c2e6102110 100644 --- a/init/calibrate.c +++ b/init/calibrate.c @@ -14,10 +14,10 @@ =20 unsigned long lpj_fine; unsigned long preset_lpj; + static int __init lpj_setup(char *str) { - preset_lpj =3D simple_strtoul(str,NULL,0); - return 1; + return kstrtoul(str, 0, &preset_lpj) =3D=3D 0; } =20 __setup("lpj=3D", lpj_setup); --=20 2.51.1