diff options
Diffstat (limited to 'fs/btrfs/xattr.c')
-rw-r--r-- | fs/btrfs/xattr.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c index 33caaf5b4b0c..85ac42605f8d 100644 --- a/fs/btrfs/xattr.c +++ b/fs/btrfs/xattr.c | |||
@@ -141,11 +141,6 @@ ssize_t btrfs_xattr_get(struct inode *inode, int name_index, | |||
141 | 141 | ||
142 | if (!handler) | 142 | if (!handler) |
143 | return -EOPNOTSUPP; | 143 | return -EOPNOTSUPP; |
144 | |||
145 | /* just in case... */ | ||
146 | if (*attr_name == '\0') | ||
147 | return -EINVAL; | ||
148 | |||
149 | name = get_name(attr_name, name_index); | 144 | name = get_name(attr_name, name_index); |
150 | if (!name) | 145 | if (!name) |
151 | return -ENOMEM; | 146 | return -ENOMEM; |
@@ -201,14 +196,8 @@ int btrfs_xattr_set(struct inode *inode, int name_index, | |||
201 | struct xattr_handler *handler = btrfs_xattr_handler(name_index); | 196 | struct xattr_handler *handler = btrfs_xattr_handler(name_index); |
202 | char *name; | 197 | char *name; |
203 | int ret = 0, mod = 0; | 198 | int ret = 0, mod = 0; |
204 | |||
205 | if (!handler) | 199 | if (!handler) |
206 | return -EOPNOTSUPP; | 200 | return -EOPNOTSUPP; |
207 | |||
208 | /* just in case... */ | ||
209 | if (*attr_name == '\0') | ||
210 | return -EINVAL; | ||
211 | |||
212 | name = get_name(attr_name, name_index); | 201 | name = get_name(attr_name, name_index); |
213 | if (!name) | 202 | if (!name) |
214 | return -ENOMEM; | 203 | return -ENOMEM; |
@@ -454,15 +443,18 @@ static int btrfs_xattr_##name##_get(struct inode *inode, \ | |||
454 | const char *name, void *value, \ | 443 | const char *name, void *value, \ |
455 | size_t size) \ | 444 | size_t size) \ |
456 | { \ | 445 | { \ |
446 | if (*name == '\0') \ | ||
447 | return -EINVAL; \ | ||
457 | return btrfs_xattr_get(inode, index, name, value, size); \ | 448 | return btrfs_xattr_get(inode, index, name, value, size); \ |
458 | } \ | 449 | } \ |
459 | static int btrfs_xattr_##name##_set(struct inode *inode, \ | 450 | static int btrfs_xattr_##name##_set(struct inode *inode, \ |
460 | const char *name, const void *value,\ | 451 | const char *name, const void *value,\ |
461 | size_t size, int flags) \ | 452 | size_t size, int flags) \ |
462 | { \ | 453 | { \ |
454 | if (*name == '\0') \ | ||
455 | return -EINVAL; \ | ||
463 | return btrfs_xattr_set(inode, index, name, value, size, flags); \ | 456 | return btrfs_xattr_set(inode, index, name, value, size, flags); \ |
464 | } \ | 457 | } \ |
465 | |||
466 | BTRFS_XATTR_SETGET_FUNCS(security, BTRFS_XATTR_INDEX_SECURITY); | 458 | BTRFS_XATTR_SETGET_FUNCS(security, BTRFS_XATTR_INDEX_SECURITY); |
467 | BTRFS_XATTR_SETGET_FUNCS(system, BTRFS_XATTR_INDEX_SYSTEM); | 459 | BTRFS_XATTR_SETGET_FUNCS(system, BTRFS_XATTR_INDEX_SYSTEM); |
468 | BTRFS_XATTR_SETGET_FUNCS(user, BTRFS_XATTR_INDEX_USER); | 460 | BTRFS_XATTR_SETGET_FUNCS(user, BTRFS_XATTR_INDEX_USER); |