xattr.c (2daf18a7884dc03d5164ab9c7dc3f2ea70638469) xattr.c (572a3d1e5d3a3e335b92e2c28a63c0b27944480c)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 File: fs/xattr.c
4
5 Extended attribute handling.
6
7 Copyright (C) 2001 by Andreas Gruenbacher <a.gruenbacher@computer.org>
8 Copyright (C) 2001 SGI - Silicon Graphics, Inc <linux-xfs@oss.sgi.com>

--- 1079 unchanged lines hidden (view full) ---

1088 struct simple_xattr *new_xattr;
1089 size_t len;
1090
1091 /* wrap around? */
1092 len = sizeof(*new_xattr) + size;
1093 if (len < sizeof(*new_xattr))
1094 return NULL;
1095
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 File: fs/xattr.c
4
5 Extended attribute handling.
6
7 Copyright (C) 2001 by Andreas Gruenbacher <a.gruenbacher@computer.org>
8 Copyright (C) 2001 SGI - Silicon Graphics, Inc <linux-xfs@oss.sgi.com>

--- 1079 unchanged lines hidden (view full) ---

1088 struct simple_xattr *new_xattr;
1089 size_t len;
1090
1091 /* wrap around? */
1092 len = sizeof(*new_xattr) + size;
1093 if (len < sizeof(*new_xattr))
1094 return NULL;
1095
1096 new_xattr = kvmalloc(len, GFP_KERNEL);
1096 new_xattr = kvmalloc(len, GFP_KERNEL_ACCOUNT);
1097 if (!new_xattr)
1098 return NULL;
1099
1100 new_xattr->size = size;
1101 memcpy(new_xattr->value, value, size);
1102 return new_xattr;
1103}
1104

--- 107 unchanged lines hidden (view full) ---

1212 int err = 0, ret;
1213
1214 /* value == NULL means remove */
1215 if (value) {
1216 new_xattr = simple_xattr_alloc(value, size);
1217 if (!new_xattr)
1218 return ERR_PTR(-ENOMEM);
1219
1097 if (!new_xattr)
1098 return NULL;
1099
1100 new_xattr->size = size;
1101 memcpy(new_xattr->value, value, size);
1102 return new_xattr;
1103}
1104

--- 107 unchanged lines hidden (view full) ---

1212 int err = 0, ret;
1213
1214 /* value == NULL means remove */
1215 if (value) {
1216 new_xattr = simple_xattr_alloc(value, size);
1217 if (!new_xattr)
1218 return ERR_PTR(-ENOMEM);
1219
1220 new_xattr->name = kstrdup(name, GFP_KERNEL);
1220 new_xattr->name = kstrdup(name, GFP_KERNEL_ACCOUNT);
1221 if (!new_xattr->name) {
1222 simple_xattr_free(new_xattr);
1223 return ERR_PTR(-ENOMEM);
1224 }
1225 }
1226
1227 write_lock(&xattrs->lock);
1228 rbp = &xattrs->rb_root.rb_node;

--- 183 unchanged lines hidden ---
1221 if (!new_xattr->name) {
1222 simple_xattr_free(new_xattr);
1223 return ERR_PTR(-ENOMEM);
1224 }
1225 }
1226
1227 write_lock(&xattrs->lock);
1228 rbp = &xattrs->rb_root.rb_node;

--- 183 unchanged lines hidden ---