Re: [lustre-devel] [PATCH 60/60] staging: lustre: libcfs: fix minimum size check for libcfs ioctl

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

 



On Wed, Feb 01, 2017 at 02:32:13PM +0100, Olaf Weber wrote:
> On 31-01-17 03:25, James Simmons wrote:
> 
> [...]
> 
> > > Also I'm uncomfortable with:
> > > 
> > > 	data = container_of(hdr, struct libcfs_ioctl_data, ioc_hdr);
> > > 
> > > If hdr isn't the first member of the struct then the code is broken but
> > > container_of() implies that that isn't a hard requirement.  It should
> > > just be:
> > > 
> > > 	data = (struct libcfs_ioctl_data *)hdr;
> > 
> > Don't know if hdr being first is a hard requirment. Doug, Amir do you know
> > if it is an requirement?
> 
> It's a requirement.

That's horrid.  Use container_of to be "safe" here please...
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux