[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Mon, 12 Dec 2022 08:50:55 -0800
From: Nhat Pham <nphamcs@...il.com>
To: Brian Foster <bfoster@...hat.com>
Cc: Al Viro <viro@...iv.linux.org.uk>, akpm@...ux-foundation.org,
hannes@...xchg.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, willy@...radead.org,
kernel-team@...a.com
Subject: Re: [PATCH v2 3/4] cachestat: implement cachestat syscall
On Mon, Dec 12, 2022 at 5:22 AM Brian Foster <bfoster@...hat.com> wrote:
>
> On Sat, Dec 10, 2022 at 11:51:32PM +0000, Al Viro wrote:
> > On Mon, Dec 05, 2022 at 09:51:39AM -0800, Nhat Pham wrote:
> >
> > > + if (!access_ok(cstat, sizeof(struct cachestat)))
> > > + return -EFAULT;
> >
> > What for? You are using copy_to_user() later, right?
> >
> > > + f = fdget(fd);
> > > + if (f.file) {
> >
> > It would be easier to read if you inverted the condition here.
> >
>
> Seconded.. I mentioned the same the last time I looked at this. On
> looking again, perhaps it might even make sense to create a
> filemap_cachestat() to split up the syscall bits from the associated map
> walking bits..? That subsequently raises the question of whether a new
> .c file is really necessary..
>
> Brian
>
Personally, I think it's better to add a new .c file for the new syscall.
But I'm impartial with respect to the refactoring otherwise. I'll just give it a
shot and see if it looks cleaner.
(BTW - I just realized this is the v2 thread. I have sent out a v3 - feel free
to take a look at that as well! These comments are still valid for the new
version though).
Powered by blists - more mailing lists