On Wed, Sep 02, 2020 at 04:40:58PM +0200, Carlos Maiolino wrote: > nameval is a variable-size array, so, define it as it, and remove all > the -1 magic number subtractions Looks good, but two little style nitpicks below. Reviewed-by: Christoph Hellwig <hch@xxxxxx> > if (be16_to_cpu(name_loc->valuelen) >= XFS_ATTR_SF_ENTSIZE_MAX) > return 0; > - bytes += sizeof(struct xfs_attr_sf_entry) - 1 > + bytes += sizeof(struct xfs_attr_sf_entry) > + name_loc->namelen > + be16_to_cpu(name_loc->valuelen); This can be condensed to: bytes += sizeof(struct xfs_attr_sf_entry) + name_loc->namelen + be16_to_cpu(name_loc->valuelen); > index c4afb33079184..f608a2966d7f8 100644 > --- a/fs/xfs/libxfs/xfs_attr_sf.h > +++ b/fs/xfs/libxfs/xfs_attr_sf.h > @@ -27,11 +27,11 @@ typedef struct xfs_attr_sf_sort { > } xfs_attr_sf_sort_t; > > #define XFS_ATTR_SF_ENTSIZE_BYNAME(nlen,vlen) /* space name/value uses */ \ > - (((int)sizeof(struct xfs_attr_sf_entry)-1 + (nlen)+(vlen))) > + (((int)sizeof(struct xfs_attr_sf_entry) + (nlen)+(vlen))) We can drop the int cast, but more importantly please add whitespaces before and after the + operator.