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 F0B3F19E97B for ; Thu, 6 Aug 2026 01:57:05 +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=1785981427; cv=none; b=tcPA3TIBGztTHSZ8tqG5h1RmwTsX8qTOfLqFLyxTxjrFRz+IeFW/YWt5d6UBM5p25fI7z1IeN7AAwEqRRNk4ugJl5okHdCJvcz51hmPRtvqZTvXBchMRiEGpC//nzL0SU5o8mrRLJ8e189UF77OkxPc0o9ZwFPc/t53MEN8KOdA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785981427; c=relaxed/simple; bh=g5Y0nnlN0QVJRxnqwHBv7XPnJXqY0G6SLYiGSGflPLk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=KrJtp7m4gC4sgp/tkO4/C605RYauvOmgWApY9sNcRHZYNh+u+pVZmesEJOiwh5kH+XWyJKB5KoEMXu8ZLuzSHkhl5DSHgUexyRViEpPi3vZsmpcdX6HOQ+/h8DKEPvlSu8n/T9853L170dcyqkogPTLpfOX/VBITi6GANeb5H2c= 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=w8CAbadW; 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="w8CAbadW" Message-ID: <6ae9914b-7254-4a1e-8345-597d3c2d7ea2@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1785981423; 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=/uTk3ewe/q6kLl+PWZH8/PgG1RIzcV92a/qRN4m/y+4=; b=w8CAbadWhcJtP+yNTReH6cOmkJMpjx8nUv9oVdDiYmkKg8C8fqcKCzjxpUtT4ZwTvxSO72 gVSl3htpqPI82+PWrYwQceMg97OpIgcrL5B6rUlnBrbgObBgzB3ZYQ56uD+Kt2cl184ZUu LoY/jnLCbbeFgBwhXrGeovi7IWrPmKo= Date: Thu, 6 Aug 2026 09:56:22 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH] mm: debug_page_alloc: fix NULL buf in debug_guardpage_minorder_setup To: John Hubbard , Andrew Morton , Vlastimil Babka Cc: Ye Liu , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20260806004556.2633049-1-ye.liu@linux.dev> <0159349a-41f2-467c-b91a-3775e56a660f@nvidia.com> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Ye Liu In-Reply-To: <0159349a-41f2-467c-b91a-3775e56a660f@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 在 2026/8/6 09:08, John Hubbard 写道: > On 8/5/26 5:45 PM, Ye Liu wrote: >> From: Ye Liu >> >> If the kernel command line includes "debug_guardpage_minorder" without >> an equals sign (i.e., no value is provided), the early parameter >> parser passes a NULL buf pointer to the setup function. >> >> kstrtouint() does not perform a NULL check on its input and calls >> directly into kstrtoull() which dereferences s[0] unconditionally, >> leading to a NULL pointer dereference and early boot crash. >> >> Additionally, the error path's pr_err("%s", buf) would also crash with >> a NULL format argument. >> > > Maybe a "Fixes:" tag is called for? > Add the following Fixes. Thanks. Fixes: c0a32fc5a2e4 ("mm: more intensive memory corruption debugging") > >> Signed-off-by: Ye Liu >> --- >> mm/debug_page_alloc.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/mm/debug_page_alloc.c b/mm/debug_page_alloc.c >> index 41e3d1f1ad96..fd2664c3c86a 100644 >> --- a/mm/debug_page_alloc.c >> +++ b/mm/debug_page_alloc.c >> @@ -22,8 +22,8 @@ static int __init debug_guardpage_minorder_setup(char *buf) >> { >> unsigned int res; >> >> - if (kstrtouint(buf, 10, &res) < 0 || res > MAX_PAGE_ORDER / 2) { >> - pr_err("Bad debug_guardpage_minorder value: %s\n", buf); >> + if (!buf || kstrtouint(buf, 10, &res) < 0 || res > MAX_PAGE_ORDER / 2) { >> + pr_err("Bad debug_guardpage_minorder value: %s\n", buf ?: "(missing)"); >> return 0; >> } >> _debug_guardpage_minorder = res; > > thanks, -- Thanks, Ye Liu