Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+25 −28
Original line number Diff line number Diff line
@@ -1307,20 +1307,19 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,

	/* Get the security descriptor */
	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)) {
		rc = PTR_ERR(pntsd);
		cERROR(1, "%s: error %d getting sec desc", __func__, rc);
	} else {
		/* allocate memory for the smb header,
		   set security descriptor request security descriptor
		   parameters, and secuirty descriptor itself */
		goto out;
	}

		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);
	if (!pnntsd) {
		cERROR(1, "Unable to allocate security descriptor");
@@ -1335,14 +1334,12 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,

	if (!rc) {
		/* Set the security descriptor */
			rc = set_cifs_acl(pnntsd, secdesclen, inode,
						path, aclflag);
		rc = set_cifs_acl(pnntsd, secdesclen, inode, path, aclflag);
		cFYI(DBG2, "set_cifs_acl rc: %d", rc);
	}

	kfree(pnntsd);
	kfree(pntsd);
	}

out:
	return rc;
}