Parent pointer attributes use a binary name, so strlen will not work. Calling functions will need to pass in the name length Signed-off-by: Allison Henderson <allison.henderson@xxxxxxxxxx> Reviewed-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> --- libxfs/xfs_attr.c | 12 ++++++++---- libxfs/xfs_attr.h | 10 ++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index fae5c9a..64fb6ef 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -76,6 +76,7 @@ xfs_attr_args_init( struct xfs_da_args *args, struct xfs_inode *dp, const unsigned char *name, + size_t namelen, int flags) { @@ -88,7 +89,7 @@ xfs_attr_args_init( args->dp = dp; args->flags = flags; args->name = name; - args->namelen = strlen((const char *)name); + args->namelen = namelen; if (args->namelen >= MAXNAMELEN) return -EFAULT; /* match IRIX behaviour */ @@ -134,6 +135,7 @@ int xfs_attr_get( struct xfs_inode *ip, const unsigned char *name, + size_t namelen, unsigned char *value, int *valuelenp, int flags) @@ -147,7 +149,7 @@ xfs_attr_get( if (XFS_FORCED_SHUTDOWN(ip->i_mount)) return -EIO; - error = xfs_attr_args_init(&args, ip, name, flags); + error = xfs_attr_args_init(&args, ip, name, namelen, flags); if (error) return error; @@ -371,6 +373,7 @@ int xfs_attr_set( struct xfs_inode *dp, const unsigned char *name, + size_t namelen, unsigned char *value, int valuelen, int flags) @@ -389,7 +392,7 @@ xfs_attr_set( if (XFS_FORCED_SHUTDOWN(dp->i_mount)) return -EIO; - error = xfs_attr_args_init(&args, dp, name, flags); + error = xfs_attr_args_init(&args, dp, name, namelen, flags); if (error) return error; @@ -519,6 +522,7 @@ int xfs_attr_remove( struct xfs_inode *dp, const unsigned char *name, + size_t namelen, int flags) { struct xfs_mount *mp = dp->i_mount; @@ -532,7 +536,7 @@ xfs_attr_remove( if (XFS_FORCED_SHUTDOWN(dp->i_mount)) return -EIO; - error = xfs_attr_args_init(&args, dp, name, flags); + error = xfs_attr_args_init(&args, dp, name, namelen, flags); if (error) return error; diff --git a/libxfs/xfs_attr.h b/libxfs/xfs_attr.h index c706976..d23cf4a 100644 --- a/libxfs/xfs_attr.h +++ b/libxfs/xfs_attr.h @@ -166,17 +166,19 @@ int xfs_attr_list_int(struct xfs_attr_list_context *); int xfs_inode_hasattr(struct xfs_inode *ip); int xfs_attr_get_ilocked(struct xfs_inode *ip, struct xfs_da_args *args); int xfs_attr_get(struct xfs_inode *ip, const unsigned char *name, - unsigned char *value, int *valuelenp, int flags); + size_t namelen, unsigned char *value, int *valuelenp, + int flags); int xfs_attr_set(struct xfs_inode *dp, const unsigned char *name, - unsigned char *value, int valuelen, int flags); + size_t namelen, unsigned char *value, int valuelen, int flags); int xfs_attr_set_args(struct xfs_da_args *args, int flags, struct xfs_buf *leaf_bp, bool roll_trans); -int xfs_attr_remove(struct xfs_inode *dp, const unsigned char *name, int flags); +int xfs_attr_remove(struct xfs_inode *dp, const unsigned char *name, + size_t namelen, int flags); int xfs_attr_remove_args(struct xfs_da_args *args, int flags, bool roll_trans); int xfs_attr_list(struct xfs_inode *dp, char *buffer, int bufsize, int flags, struct attrlist_cursor_kern *cursor); int xfs_attr_args_init(struct xfs_da_args *args, struct xfs_inode *dp, - const unsigned char *name, int flags); + const unsigned char *name, size_t namelen, int flags); int xfs_attr_calc_size(struct xfs_da_args *args, int *local); int xfs_attr_set_deferred(struct xfs_inode *dp, struct xfs_defer_ops *dfops, void *name, unsigned int name_len, void *value, -- 2.7.4 -- 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