diff options
Diffstat (limited to 'fs/hfsplus/attributes.c')
-rw-r--r-- | fs/hfsplus/attributes.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/fs/hfsplus/attributes.c b/fs/hfsplus/attributes.c index caf89a7be0a1..f3345c0b1c62 100644 --- a/fs/hfsplus/attributes.c +++ b/fs/hfsplus/attributes.c | |||
@@ -54,14 +54,11 @@ int hfsplus_attr_build_key(struct super_block *sb, hfsplus_btree_key *key, | |||
54 | memset(key, 0, sizeof(struct hfsplus_attr_key)); | 54 | memset(key, 0, sizeof(struct hfsplus_attr_key)); |
55 | key->attr.cnid = cpu_to_be32(cnid); | 55 | key->attr.cnid = cpu_to_be32(cnid); |
56 | if (name) { | 56 | if (name) { |
57 | len = strlen(name); | 57 | int res = hfsplus_asc2uni(sb, |
58 | if (len > HFSPLUS_ATTR_MAX_STRLEN) { | ||
59 | pr_err("invalid xattr name's length\n"); | ||
60 | return -EINVAL; | ||
61 | } | ||
62 | hfsplus_asc2uni(sb, | ||
63 | (struct hfsplus_unistr *)&key->attr.key_name, | 58 | (struct hfsplus_unistr *)&key->attr.key_name, |
64 | HFSPLUS_ATTR_MAX_STRLEN, name, len); | 59 | HFSPLUS_ATTR_MAX_STRLEN, name, strlen(name)); |
60 | if (res) | ||
61 | return res; | ||
65 | len = be16_to_cpu(key->attr.key_name.length); | 62 | len = be16_to_cpu(key->attr.key_name.length); |
66 | } else { | 63 | } else { |
67 | key->attr.key_name.length = 0; | 64 | key->attr.key_name.length = 0; |