From nobody Tue Dec 16 07:55:39 2025 Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (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 77AA0F9E8 for ; Sun, 14 Dec 2025 15:32:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765726337; cv=none; b=TQK1e8ZW3NgeV0xe9xo+ct2H2PNdn7GhJubQqN4NpDT1G7PK0YGNUURCUmMJ0Ie4zcUOfqcm1yOZU3XVrylIR6pIZFswn1OZQVQ8iOPhSTXNe4gqEWsqPuWTH0aiVT//Vc3SbjtNCXK1r3eh4tdIWrXp6zPp+R4x87QnKXETbck= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765726337; c=relaxed/simple; bh=Z9rFZA0pSS0lqSIo5S0dvhHqpgQtwqAPtP/IqtMG1Zs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=p0+eI+GwWYKjms/KfuhRuPUih/GST/NBke4DkTyMZZvcYQBGEJmqdHQKObJP/qIZLdfkVXv9IkbChYoYGr+gf1BdgTi30MHoa0HbrGHWwGGQxcIe0FmpH6XbGpJCogIMVH6cFJjG3IwwGx/MXcIFMJq+aSK7z1vnLi2dOFHq2f0= 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=ZEDzy2NH; arc=none smtp.client-ip=91.218.175.182 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="ZEDzy2NH" 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=1765726328; 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=9xx1fqAW3dfvCXG5+4q/Ki6oBzGLhoeu96umkb5NnBA=; b=ZEDzy2NHG9NTqEDW1C9yWaRm7C4n17XfQto7/YMi3tsVlQV1e+78RkEWhkzjZeYaOnSXwj w/F+wErEyy4rdCqWGEEQxYQ1qe0hev2aGQYr0SRFUYh91Az6Z3c+UdRQPVlGd7Dn072TUO YHXTvIsD3AmVldLHy+PLv/JESLdidI0= From: Thorsten Blum To: Alexander Viro , Christian Brauner , Jan Kara Cc: Thorsten Blum , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] namespace: Replace simple_strtoul with kstrtoul to parse boot params Date: Sun, 14 Dec 2025 16:31:42 +0100 Message-ID: <20251214153141.218953-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 'mhash_entries=3D' and 'mphash_entries=3D' boot parameters. Check the return value of kstrtoul() and reject invalid values. This adds error handling while preserving behavior for existing values, and removes use of the deprecated simple_strtoul() helper. Signed-off-by: Thorsten Blum --- fs/namespace.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index c58674a20cad..a548369ddb9c 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -49,20 +49,14 @@ static unsigned int mp_hash_shift __ro_after_init; static __initdata unsigned long mhash_entries; static int __init set_mhash_entries(char *str) { - if (!str) - return 0; - mhash_entries =3D simple_strtoul(str, &str, 0); - return 1; + return kstrtoul(str, 0, &mhash_entries) =3D=3D 0; } __setup("mhash_entries=3D", set_mhash_entries); =20 static __initdata unsigned long mphash_entries; static int __init set_mphash_entries(char *str) { - if (!str) - return 0; - mphash_entries =3D simple_strtoul(str, &str, 0); - return 1; + return kstrtoul(str, 0, &mphash_entries) =3D=3D 0; } __setup("mphash_entries=3D", set_mphash_entries); =20 --=20 Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4