From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 F16E2155757 for ; Thu, 25 Jun 2026 20:04:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782417887; cv=none; b=XwlVXJEinmRYj0A2CVMwxoSFgE2ZQIZ7h6RGl2/2Jl3ufaJR+oJSuNwWK6q4hLiX5AXQVi44RLcRhif80rLxzHrJoCy4z+6I9xpKtBy5WxKA7ExwCo5h7MXtEwNAkiYN6XjhCookFfFIYR0Qa7Xa5Pha/bMamExdw/j+v1Gsce0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782417887; c=relaxed/simple; bh=y83drPxr6doGTQkLWx3nPauXUv/zfP82RyJs3aJk/xo=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=MkdpftH2vQQSYeMfEMxdJ+y1LirjcPnKeqv8q2sDAuV2S6XFAeQhyq9y0s4zsMvE99PpNXRsggoojJCR7RXwlnV4wD+fkiokkQjblXvzU7iopBofNW6r7ZgSZ474ZUIqsvCZAqHiuZntu6HY31DKiwVSjDo5EOVBlSCElzbWFl8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=OSPU4nIe; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="OSPU4nIe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 379901F000E9; Thu, 25 Jun 2026 20:04:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1782417886; bh=CXGH1UvQbMl2j6fWiW2DtmHdB8JpN1V560SSVMXBRtU=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=OSPU4nIeZKft2aL4RW4g2m0Z18E5Hxst0IbluKYPXeido+YkxPkI3aelzr0+qy7pJ KcXpGnyD87rwMsWHtaVKMAMcCu9jc++8lfKoKQC+MMXceXt7j96rEjNayM/RR2+2xt wvyq467XDkdifxtGCNp4pyaGIt2S0S8PL+SoLSlk= Date: Thu, 25 Jun 2026 13:04:45 -0700 From: Andrew Morton To: "Zi Yan" Cc: "Zhen Ni" , , , , , , , Subject: Re: [PATCH v11 2/4] mm/page_owner: add NUMA node filter Message-Id: <20260625130445.347e3fcc6d271b988fceacd4@linux-foundation.org> In-Reply-To: References: <20260625043101.338794-1-zhen.ni@easystack.cn> <20260625043101.338794-3-zhen.ni@easystack.cn> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 25 Jun 2026 15:27:57 -0400 "Zi Yan" wrote: > > > > /* > > * Maximum input length for filter commands: > > - * 32: print_mode command max length is 17 ("mode=stack_handle"). > > + * - 32: print_mode command max length is 17 ("mode=stack_handle") > > + * with sufficient buffer > > + * - 6 * MAX_NUMNODES: worst case for nid list > > + * Worst case per node: ",NNNNN" (comma + 5-digit node number) = 6 bytes > > */ > > - max_input_len = 32; > > + max_input_len = 32 + 6 * MAX_NUMNODES; > > > > if (count > max_input_len) > > return -EINVAL; > > Hi Andrew, > > This needs to be fixed as well. yep, I did that in the obvious way: @@ -934,14 +961,20 @@ static ssize_t page_owner_write(struct f char *token; int ret; struct page_owner_filter_state *state = file->private_data; + nodemask_t new_nid_filter; + bool new_nid_filter_enabled; enum page_owner_print_mode new_print_mode; unsigned long flags; /* * Maximum input length for filter commands: - * 32: print_mode command max length is 17 ("mode=stack_handle"). + * - 32: print_mode command max length is 17 ("mode=stack_handle") + * with sufficient buffer + * - 6 * MAX_NUMNODES: worst case for nid list + * Worst case per node: ",NNNNN" (comma + 5-digit node number) = 6 + * bytes */ - if (count > 32) + if (count > 32 + 6 * MAX_NUMNODES) return -EINVAL; kbuf = memdup_user_nul(buf, count);