Re: [PATCH 07/13] xfs: create structure verifier function for shortform xattrs

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

 



On Wed, Dec 20, 2017 at 07:51:29AM +1100, Dave Chinner wrote:
> On Tue, Dec 19, 2017 at 12:41:47PM -0800, Darrick J. Wong wrote:
> > On Tue, Dec 19, 2017 at 04:23:29PM +1100, Dave Chinner wrote:
> > > On Wed, Dec 13, 2017 at 03:58:55PM -0800, Darrick J. Wong wrote:
> > > > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> > > > 
> > > > Create a function to perform structure verification for short form
> > > > extended attributes.
> > > > 
> > > > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> > > > ---
> > > > +		/* Check for invalid namespace combinations. */
> > > > +		if ((sfep->flags & XFS_ATTR_ROOT) &&
> > > > +		    (sfep->flags & XFS_ATTR_SECURE))
> > > > +			return __this_address;
> > > 
> > > #define ATTR_SF_FLAGS	(XFS_ATTR_ROOT | XFS_ATTR_SECURE)
> > 
> > XFS_ATTR_NSP_ONDISK_MASK?
> 
> Yeah, that works. I didn't go looking for an existing definition :/
> 
> > > 
> > > 		if (sfep->flags & ~ATTR_SF_FLAGS)
> > > 			return __this_address;
> > > 		if ((sfep->flags & ATTR_SF_FLAGS) == ATTR_SF_FLAGS)
> > > 			return __this_address;
> > 
> > Also, can we just use hweight8() > 1 here?  We only allow one namespace
> > bit per attr.
> 
> With a comment, yes, otherwise someone unfamiliar with what
> hweight() does will have to go do lots of extra work to understand
> the code.

/*
 * Check for invalid namespace combinations.  We only allow
 * one namespace flag per xattr, so we can just count the
 * bits (i.e. hweight) here.
 */

--D

> 
> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@xxxxxxxxxxxxx
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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