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 E36D131E84A for ; Thu, 25 Jun 2026 19:20:31 +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=1782415232; cv=none; b=bu2h7i2O49RuLVbfW09BPXlFvjbeauRt/Pqb5WAZPJc3UWwsndIdLT9LhPTTWnZkvrCjKtkkWf2nvn8WxlvZCGf1SurDbFQN52Fiz97IggG22P4wGwI9M+qEfuYTJR0/lQefZoYzeJIYLP/5wJOfBkM+YviGICwOJt75Nr9lWO8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782415232; c=relaxed/simple; bh=f9hSwsCSwz8qD4135njYxguSj4MhYbcipimJlmeTtRo=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=pRG5qfm0Ty+rGwpAdxk2xJl6GJw0hw+8+7zfDxqYd4xdheKWWBrqovBiPrjyuhBJ4ks+se9iWqT0uWc0rqE7/fvePaBbAlV7sKRbeMQg+RCPTGHjMPhwBfBelI6epgF48p5No3+uy853rtlIhhOCVe/bdCm5CEPW9ZPBVLMS/rI= 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=je/Vy0CI; 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="je/Vy0CI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B9621F00A3A; Thu, 25 Jun 2026 19:20:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1782415231; bh=SeIALQ9lVn1SIsM1liZMf7kfmaSTEnAC37rRwjunoxA=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=je/Vy0CIHpoD1UZ+Zs15gC66MSj4pUuNtNzTrgiqpkSQLVYaQg4ptaEIrGpH0GSui pw/S20iVb3w/jeBInkGF+H0ZTH8jloS0jGhuuGzf7iEz0RXefIYJG+r3SMJ5SWp5SL Cra8MQIWcrQDtGDJarVb7d04LHtNjR7FAyU34wA0= Date: Thu, 25 Jun 2026 12:20:30 -0700 From: Andrew Morton To: "Zi Yan" Cc: "Zhen Ni" , , , , , , , Subject: Re: [PATCH v11 1/4] mm/page_owner: add print_mode filter Message-Id: <20260625122030.c036caf02435810b5ba0e291@linux-foundation.org> In-Reply-To: References: <20260625043101.338794-1-zhen.ni@easystack.cn> <20260625043101.338794-2-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 14:26:51 -0400 "Zi Yan" 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); _