Commit c78cd838 authored by Jeff Layton's avatar Jeff Layton Committed by Steve French

cifs: clean up id_mode_to_cifs_acl

Add a label we can goto on error, and get rid of some excess indentation.
Also move to kernel-style comments.
Reviewed-by: default avatarShirish Pargaonkar <shirishpargaonkar@gmail.com>
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <smfrench@gmail.com>
parent 60654ce0
...@@ -1307,20 +1307,19 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode, ...@@ -1307,20 +1307,19 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
/* Get the security descriptor */ /* Get the security descriptor */
pntsd = get_cifs_acl(CIFS_SB(inode->i_sb), inode, path, &secdesclen); pntsd = get_cifs_acl(CIFS_SB(inode->i_sb), inode, path, &secdesclen);
/* Add three ACEs for owner, group, everyone getting rid of
other ACEs as chmod disables ACEs and set the security descriptor */
if (IS_ERR(pntsd)) { if (IS_ERR(pntsd)) {
rc = PTR_ERR(pntsd); rc = PTR_ERR(pntsd);
cERROR(1, "%s: error %d getting sec desc", __func__, rc); cERROR(1, "%s: error %d getting sec desc", __func__, rc);
} else { goto out;
/* allocate memory for the smb header, }
set security descriptor request security descriptor
parameters, and secuirty descriptor itself */
secdesclen = secdesclen < DEFSECDESCLEN ? /*
DEFSECDESCLEN : secdesclen; * Add three ACEs for owner, group, everyone getting rid of other ACEs
* as chmod disables ACEs and set the security descriptor. Allocate
* memory for the smb header, set security descriptor request security
* descriptor parameters, and secuirty descriptor itself
*/
secdesclen = max_t(u32, secdesclen, DEFSECDESCLEN);
pnntsd = kmalloc(secdesclen, GFP_KERNEL); pnntsd = kmalloc(secdesclen, GFP_KERNEL);
if (!pnntsd) { if (!pnntsd) {
cERROR(1, "Unable to allocate security descriptor"); cERROR(1, "Unable to allocate security descriptor");
...@@ -1335,14 +1334,12 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode, ...@@ -1335,14 +1334,12 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
if (!rc) { if (!rc) {
/* Set the security descriptor */ /* Set the security descriptor */
rc = set_cifs_acl(pnntsd, secdesclen, inode, rc = set_cifs_acl(pnntsd, secdesclen, inode, path, aclflag);
path, aclflag);
cFYI(DBG2, "set_cifs_acl rc: %d", rc); cFYI(DBG2, "set_cifs_acl rc: %d", rc);
} }
kfree(pnntsd); kfree(pnntsd);
kfree(pntsd); kfree(pntsd);
} out:
return rc; return rc;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment