Commit f945ca19 authored by Miklos Szeredi's avatar Miklos Szeredi
Browse files

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: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent d8991e86
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ int ovl_copy_xattr(struct super_block *sb, struct dentry *old,
		return list_size;
	}

	buf = kzalloc(list_size, GFP_KERNEL);
	buf = kvzalloc(list_size, GFP_KERNEL);
	if (!buf)
		return -ENOMEM;

@@ -106,11 +106,12 @@ int ovl_copy_xattr(struct super_block *sb, struct dentry *old,
		if (size > value_size) {
			void *new;

			new = krealloc(value, size, GFP_KERNEL);
			new = kvmalloc(size, GFP_KERNEL);
			if (!new) {
				error = -ENOMEM;
				break;
			}
			kvfree(value);
			value = new;
			value_size = size;
			goto retry;
@@ -125,9 +126,9 @@ int ovl_copy_xattr(struct super_block *sb, struct dentry *old,
			error = 0;
		}
	}
	kfree(value);
	kvfree(value);
out:
	kfree(buf);
	kvfree(buf);
	return error;
}