From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) (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 30CEA2ED844 for ; Mon, 15 Dec 2025 14:18:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765808287; cv=none; b=MyFmFfFlNt11yY6Ak2M/z6QbMfjFnwhRwxM5ef5XxHiJJZa/9VxuxRRxwFj4S/ARUsMuD1Gc6kxbLJZVoGlUdr8xMBKxcvn5DzKIqwIaIkT/MhAdZo3BaSQVa3hwO6SfUoGRhHMmuZYwI5VCsXDTpF/r6f7eRbcmCc/c0aYKaHY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765808287; c=relaxed/simple; bh=DVXX00EvWSkvKgIKYW6V02V2bN4a5dGFmPLMTUDmkgs=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=SwGuo33gbSemzbCe83dV2SOky/p6nO233htoVa/QR5rG+Z5eKi7IAV0VTg89epvYvO1iiriZSflkOj5mECGwPClh0xpofyCz6aEnzHLqkk0uoLf1aKA05hB325Z269RZTs8uI0dc03PxwSJj8rtnM17kBeqj14YxHhh92oQ2RnE= 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=t0NoRFkg; arc=none smtp.client-ip=95.215.58.189 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="t0NoRFkg" Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1765808270; 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=2w9jfozl4pegwTIhi1nuDTYSt+1YDok7xKyhV+Gat4I=; b=t0NoRFkg+xVOYewT1Y/OXijRVKM/ZqYjS8HJrH1HTlaezWGTsc35M625VSofKi/f9rZsZs WRLqDOe07blna9I6pzr5ONssUa4diF2k6iCX7qp7f5aJ4G/CR+OG2XLKKtg42yRp4OG2iv hq3HT3mshKUzlmhOgoij/cxxKXBRFB4= 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\)) Subject: Re: [PATCH] namespace: Replace simple_strtoul with kstrtoul to parse boot params X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Thorsten Blum In-Reply-To: <3hnvigpwa2jomy6wimsdkkz4da64x7nsk4ffoko47ocpokqbou@fqymwie5damt> Date: Mon, 15 Dec 2025 15:17:14 +0100 Cc: Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: 7bit Message-Id: References: <20251214153141.218953-2-thorsten.blum@linux.dev> <3hnvigpwa2jomy6wimsdkkz4da64x7nsk4ffoko47ocpokqbou@fqymwie5damt> To: Jan Kara X-Migadu-Flow: FLOW_OUT On 15. Dec 2025, at 10:15, Jan Kara wrote: > On Sun 14-12-25 16:31:42, Thorsten Blum wrote: >> Replace simple_strtoul() with the recommended kstrtoul() for parsing the >> 'mhash_entries=' and 'mphash_entries=' 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 > > ... > >> @@ -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 = simple_strtoul(str, &str, 0); >> - return 1; >> + return kstrtoul(str, 0, &mhash_entries) == 0; >> } >> __setup("mhash_entries=", set_mhash_entries); > > I'm not very experienced with the cmdline option parsing but AFAICT the > 'str' argument can be indeed NULL and kstrtoul() will not be happy with > that? I don't think 'str' can be NULL. If you don't pass a value, 'str' will be the empty string (just tested this). Thanks, Thorsten