Skip to content

Commit

Permalink
FreeBSD: Use SET_ERROR to trace xattr name errors
Browse files Browse the repository at this point in the history
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes openzfs#11997
  • Loading branch information
Ryan Moeller authored and rincebrain committed May 17, 2021
1 parent eb019fe commit 92f2657
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions module/os/freebsd/zfs/zfs_vnops_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -5250,10 +5250,10 @@ zfs_create_attrname(int attrnamespace, const char *name, char *attrname,

/* We don't allow '/' character in attribute name. */
if (strchr(name, '/') != NULL)
return (EINVAL);
return (SET_ERROR(EINVAL));
/* We don't allow attribute names that start with "freebsd:" string. */
if (strncmp(name, "freebsd:", 8) == 0)
return (EINVAL);
return (SET_ERROR(EINVAL));

bzero(attrname, size);

Expand All @@ -5278,11 +5278,11 @@ zfs_create_attrname(int attrnamespace, const char *name, char *attrname,
break;
case EXTATTR_NAMESPACE_EMPTY:
default:
return (EINVAL);
return (SET_ERROR(EINVAL));
}
if (snprintf(attrname, size, "%s%s%s%s", prefix, namespace, suffix,
name) >= size) {
return (ENAMETOOLONG);
return (SET_ERROR(ENAMETOOLONG));
}
return (0);
}
Expand Down

0 comments on commit 92f2657

Please sign in to comment.