Skip to contentSkip to conversation

posix_acl: Add the check items

PATCH In review Liuwenyi 1 participant 1 message Dec 21, 2009

Subsystems (2)
lore
Share & tools
lore

Liuwenyi

author
#0 lore raw

PATCH v2 9/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.

---

---

fs/nfsd/nfs4acl.c +0 -0
index 8815068..0c2cd6c 100644
@@ -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;
}

Signature · 2 lines
Best Regards,
Liuwenyi