Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Zi Yan <ziy@nvidia.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Zhen Ni <zhen.ni@easystack.cn>,
	vbabka@kernel.org, surenb@google.com, mhocko@suse.com,
	jackmanb@google.com, hannes@cmpxchg.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v11 1/4] mm/page_owner: add print_mode filter
Date: Thu, 25 Jun 2026 15:24:03 -0400	[thread overview]
Message-ID: <1EB1B920-FCF1-49F5-B602-DAACF3B97A30@nvidia.com> (raw)
In-Reply-To: <20260625122030.c036caf02435810b5ba0e291@linux-foundation.org>

On 25 Jun 2026, at 15:20, Andrew Morton wrote:

> On Thu, 25 Jun 2026 14:26:51 -0400 "Zi Yan" <ziy@nvidia.com> wrote:
>
>>> +static ssize_t page_owner_write(struct file *file,
>>> +				 const char __user *buf,
>>> +				 size_t count, loff_t *ppos)
>>> +{
>>> +	char *kbuf;
>>> +	char *orig;
>>> +	char *token;
>>> +	int ret;
>>> +	size_t max_input_len;
>>
>> This can be const size_t max_input_len = 32 with the comment above it.
>
> I don't think that local adds any value, really.  How about
>
> --- a/mm/page_owner.c~mm-page_owner-add-print_mode-filter-fix
> +++ a/mm/page_owner.c
> @@ -933,7 +933,6 @@ static ssize_t page_owner_write(struct f
>  	char *orig;
>  	char *token;
>  	int ret;
> -	size_t max_input_len;
>  	struct page_owner_filter_state *state = file->private_data;
>  	enum page_owner_print_mode new_print_mode;
>  	unsigned long flags;
> @@ -942,9 +941,7 @@ static ssize_t page_owner_write(struct f
>  	 * Maximum input length for filter commands:
>  	 * 32: print_mode command max length is 17 ("mode=stack_handle").
>  	 */
> -	max_input_len = 32;
> -
> -	if (count > max_input_len)
> +	if (count > 32)
>  		return -EINVAL;
>
>  	kbuf = memdup_user_nul(buf, count);
> _

Looks good to me.

Best Regards,
Yan, Zi


  reply	other threads:[~2026-06-25 19:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-25  4:30 [PATCH v11 0/4] mm/page_owner: add per-fd filter infrastructure for print_mode and NUMA filtering Zhen Ni
2026-06-25  4:30 ` [PATCH v11 1/4] mm/page_owner: add print_mode filter Zhen Ni
2026-06-25 18:26   ` Zi Yan
2026-06-25 19:20     ` Andrew Morton
2026-06-25 19:24       ` Zi Yan [this message]
2026-06-25  4:30 ` [PATCH v11 2/4] mm/page_owner: add NUMA node filter Zhen Ni
2026-06-25 18:37   ` Zi Yan
2026-06-26  8:20     ` zhen.ni
2026-06-25 19:27   ` Zi Yan
2026-06-25 20:04     ` Andrew Morton
2026-06-25  4:31 ` [PATCH v11 3/4] tools/mm: add page_owner_filter userspace tool Zhen Ni
2026-06-25  4:50   ` Andrew Morton
2026-06-25  4:31 ` [PATCH v11 4/4] mm/page_owner: document page_owner filter Zhen Ni
2026-06-25  4:55 ` [PATCH v11 0/4] mm/page_owner: add per-fd filter infrastructure for print_mode and NUMA filtering Andrew Morton
2026-06-25 12:57   ` zhen.ni
2026-06-25 18:22 ` Zi Yan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1EB1B920-FCF1-49F5-B602-DAACF3B97A30@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=zhen.ni@easystack.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox