From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58882C433EF for ; Thu, 2 Jun 2022 22:25:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E22476B0073; Thu, 2 Jun 2022 18:25:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD65D6B0074; Thu, 2 Jun 2022 18:25:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CBE556B0075; Thu, 2 Jun 2022 18:25:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id BC65F6B0073 for ; Thu, 2 Jun 2022 18:25:23 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8AD5421644 for ; Thu, 2 Jun 2022 22:25:23 +0000 (UTC) X-FDA: 79534728126.12.3DF3CCC Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by imf24.hostedemail.com (Postfix) with ESMTP id 3F052180064 for ; Thu, 2 Jun 2022 22:25:07 +0000 (UTC) Date: Thu, 2 Jun 2022 15:25:14 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1654208721; 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: in-reply-to:in-reply-to:references:references; bh=iXbffRTpMmUtQ/ZhrbG1S7JhzFZozsv7ZKcRHIDCN1U=; b=qfIcXOjuztQwEvPSWbPAXRki0ZBCjbBpbDCUNM/xNUbkZ3Whob4ZqZyoLxUd6nbl+MNIel WBUvYdT2Ap/d+ZoEMvx6aIn3SEETYL2HgJop07TpJTblFpxX3upoLQzbgUHKpBpr/WuMR8 aGZGecnRtnnZv5ri3c4UXMuII4emIW4= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Andrew Morton Cc: linux-mm@kvack.org, Dave Chinner , linux-kernel@vger.kernel.org, Kent Overstreet , Hillf Danton , Christophe JAILLET , Muchun Song Subject: Re: [PATCH v5 6/6] mm: shrinkers: add scan interface for shrinker debugfs Message-ID: References: <20220601032227.4076670-1-roman.gushchin@linux.dev> <20220601032227.4076670-7-roman.gushchin@linux.dev> <20220601142351.5e04fea5586ca51898d8785f@linux-foundation.org> <20220602114132.f6e5675b2d2a4085b9b1e8c4@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220602114132.f6e5675b2d2a4085b9b1e8c4@linux-foundation.org> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=qfIcXOju; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf24.hostedemail.com: domain of roman.gushchin@linux.dev designates 94.23.1.103 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 3F052180064 X-Rspam-User: X-Stat-Signature: 15ucj4yh8ezo53xge6yc3nbejwa6p9sb X-HE-Tag: 1654208707-90786 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Jun 02, 2022 at 11:41:32AM -0700, Andrew Morton wrote: > On Wed, 1 Jun 2022 17:56:22 -0700 Roman Gushchin wrote: > > > > > > > > + ssize_t ret; > > > > + > > > > + if (copy_from_user(kbuf, buf, read_len)) > > > > + return -EFAULT; > > > > + kbuf[read_len] = '\0'; > > > > + > > > > + if (sscanf(kbuf, "%lu %d %lu", &ino, &nid, &nr_to_scan) < 2) > > > > > > Was it intentional to permit more than three args? > > > > Good catch! No, of course it wasn't intentional. > > > > Below is an updated version of this patch. > > > > ... > > > > + if (sscanf(kbuf, "%lu %d %lu", &ino, &nid, &nr_to_scan) != 2) > > + return -EINVAL; > > s/2/3/methinks? > > My bad, of course. Thanks! -- diff --git a/mm/shrinker_debug.c b/mm/shrinker_debug.c index 12026472daae..e5b40c43221d 100644 --- a/mm/shrinker_debug.c +++ b/mm/shrinker_debug.c @@ -124,7 +124,7 @@ static ssize_t shrinker_debugfs_scan_write(struct file *file, return -EFAULT; kbuf[read_len] = '\0'; - if (sscanf(kbuf, "%lu %d %lu", &ino, &nid, &nr_to_scan) != 2) + if (sscanf(kbuf, "%lu %d %lu", &ino, &nid, &nr_to_scan) != 3) return -EINVAL; if (nid < 0 || nid >= nr_node_ids)