Re: [PATCH 05/31] xfs: use strndup_user in XFS_IOC_ATTRMULTI_BY_HANDLE

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

 



On Tue, Feb 18, 2020 at 04:38:16PM -0800, Darrick J. Wong wrote:
> On Tue, Feb 18, 2020 at 04:24:32PM +0100, Christoph Hellwig wrote:
> > On Tue, Feb 18, 2020 at 09:15:39AM +1100, Dave Chinner wrote:
> > > >  
> > > > -		ops[i].am_error = strncpy_from_user((char *)attr_name,
> > > > -				ops[i].am_attrname, MAXNAMELEN);
> > > > -		if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN)
> > > > -			error = -ERANGE;
> > > > -		if (ops[i].am_error < 0)
> > > > +		attr_name = strndup_user(ops[i].am_attrname, MAXNAMELEN);
> > > > +		if (IS_ERR(attr_name)) {
> > > > +			ops[i].am_error = PTR_ERR(attr_name);
> > > >  			break;
> > > > +		}
> > > 
> > > This changes the error returned for an invalid attr name length from
> > > -ERANGE to either -EINVAL or -EFAULT. Can you please document that
> > > in the commit message. This change requires updates to the 
> > > path_to_handle(3) man page shipped in xfsprogs in the xfslibs-dev
> > > package (xfsprogs::man/man3/handle.3) to document the differences in
> > > return values.
> > 
> > I can't find that man page documenting -ERANGE at all..
> 
> Should we add both to the errors list, then?  Seeing as (I think?) the
> kernel can actually return this...

IMO, yes.

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux