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 RageLtMan committed May 31, 2021
1 parent 8b4eccc commit 13d9ca9
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 @@ -5303,10 +5303,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 @@ -5331,11 +5331,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 13d9ca9

Please sign in to comment.