提交 f945ca19 编写于 作者: M Miklos Szeredi

ovl: use kvalloc in xattr copy-up

Extended attributes are usually small, but could be up to 64k in size, so
use the most efficient method for doing the allocation.
Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
上级 d8991e86
...@@ -63,7 +63,7 @@ int ovl_copy_xattr(struct super_block *sb, struct dentry *old, ...@@ -63,7 +63,7 @@ int ovl_copy_xattr(struct super_block *sb, struct dentry *old,
return list_size; return list_size;
} }
buf = kzalloc(list_size, GFP_KERNEL); buf = kvzalloc(list_size, GFP_KERNEL);
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
...@@ -106,11 +106,12 @@ int ovl_copy_xattr(struct super_block *sb, struct dentry *old, ...@@ -106,11 +106,12 @@ int ovl_copy_xattr(struct super_block *sb, struct dentry *old,
if (size > value_size) { if (size > value_size) {
void *new; void *new;
new = krealloc(value, size, GFP_KERNEL); new = kvmalloc(size, GFP_KERNEL);
if (!new) { if (!new) {
error = -ENOMEM; error = -ENOMEM;
break; break;
} }
kvfree(value);
value = new; value = new;
value_size = size; value_size = size;
goto retry; goto retry;
...@@ -125,9 +126,9 @@ int ovl_copy_xattr(struct super_block *sb, struct dentry *old, ...@@ -125,9 +126,9 @@ int ovl_copy_xattr(struct super_block *sb, struct dentry *old,
error = 0; error = 0;
} }
} }
kfree(value); kvfree(value);
out: out:
kfree(buf); kvfree(buf);
return error; return error;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册