[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4B2F6338.2040609@gmail.com>
Date: Mon, 21 Dec 2009 19:59:52 +0800
From: Liuwenyi <qingshenlwy@...il.com>
To: bfields@...ldses.org, neilb@...e.de, ffilzlnx@...ibm.com,
bharrosh@...asas.com, linux-nfs@...r.kernel.org,
linux-kernel@...r.kernel.org, strongzgy@...il.com,
onlyflyer@...il.com
Subject: [PATCHv2 09/12]posix_acl: Add the check items
move the ACL validation check in to fs/posix_acl.c.
Including nullpointer check and PTR_ERR check.
---
Signed-off-by: Liuwenyi <qingshenlwy@...il.com>
Cc: J. Bruce Fields <bfields@...ldses.org>
Cc: Neil Brown <neilb@...e.de>
Cc: Frank Filz <ffilzlnx@...ibm.com>
Cc: Boaz Harrosh <bharrosh@...asas.com>
Cc: linux-nfs@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
---
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c
index 8815068..0c2cd6c 100644
--- a/fs/nfsd/nfs4acl.c
+++ b/fs/nfsd/nfs4acl.c
@@ -135,27 +135,21 @@ nfs4_acl_posix_to_nfsv4(struct posix_acl *pacl,
struct posix_acl *dpacl,
struct nfs4_acl *acl;
int size = 0;
- if (pacl) {
- if (posix_acl_valid(pacl) < 0)
- return ERR_PTR(-EINVAL);
- size += 2*pacl->a_count;
- }
- if (dpacl) {
- if (posix_acl_valid(dpacl) < 0)
- return ERR_PTR(-EINVAL);
- size += 2*dpacl->a_count;
- }
+ if (posix_acl_valid(pacl) < 0)
+ return ERR_PTR(-EINVAL);
+ size += 2*pacl->a_count;
+
+ if (posix_acl_valid(dpacl) < 0)
+ return ERR_PTR(-EINVAL);
+ size += 2*dpacl->a_count;
/* Allocate for worst case: one (deny, allow) pair each: */
acl = nfs4_acl_new(size);
if (acl == NULL)
return ERR_PTR(-ENOMEM);
- if (pacl)
- _posix_to_nfsv4_one(pacl, acl, flags & ~NFS4_ACL_TYPE_DEFAULT);
-
- if (dpacl)
- _posix_to_nfsv4_one(dpacl, acl, flags | NFS4_ACL_TYPE_DEFAULT);
+ _posix_to_nfsv4_one(pacl, acl, flags & ~NFS4_ACL_TYPE_DEFAULT);
+ _posix_to_nfsv4_one(dpacl, acl, flags | NFS4_ACL_TYPE_DEFAULT);
return acl;
}
--
Best Regards,
Liuwenyi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists