[Cluster-devel] [PATCH] gfs2: using posix_acl_xattr_size() to get size instead of posix_acl_to_xattr()

Chengguang Xu cgxu519 at gmx.com
Fri Jun 22 01:51:43 UTC 2018


There is no functional change but it seems better to get size by calling
posix_acl_xattr_size() instead of calling posix_acl_to_xattr() with
NULL buffer argument.

Signed-off-by: Chengguang Xu <cgxu519 at gmx.com>
---
 fs/gfs2/acl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index 776717f1eeea..b2ff1b5685c7 100644
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -82,12 +82,12 @@ struct posix_acl *gfs2_get_acl(struct inode *inode, int type)
 int __gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
 {
 	int error;
-	int len;
+	size_t len;
 	char *data;
 	const char *name = gfs2_acl_name(type);
 
 	if (acl) {
-		len = posix_acl_to_xattr(&init_user_ns, acl, NULL, 0);
+		len = posix_acl_xattr_size(acl->a_count);
 		if (len == 0)
 			return 0;
 		data = kmalloc(len, GFP_NOFS);
-- 
2.17.1




More information about the Cluster-devel mailing list