Re: [PATCH v2 3/4] cachestat: implement cachestat syscall

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux