Commit ea7099d5 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'Smack-for-6.0' of https://github.com/cschaufler/smack-next

Pull msack updates from Casey Schaufler:
 "Two minor code clean-ups for Smack.

  One removes a touch of dead code and the other replaces an instance of
  kzalloc + strncpy with kstrndup"

* tag 'Smack-for-6.0' of https://github.com/cschaufler/smack-next:
  smack: Remove the redundant lsm_inode_alloc
  smack: Replace kzalloc + strncpy with kstrndup
parents 1b6cf909 aa16fb4b
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -465,12 +465,9 @@ char *smk_parse_smack(const char *string, int len)
	if (i == 0 || i >= SMK_LONGLABEL)
		return ERR_PTR(-EINVAL);

	smack = kzalloc(i + 1, GFP_NOFS);
	if (smack == NULL)
	smack = kstrndup(string, i, GFP_NOFS);
	if (!smack)
		return ERR_PTR(-ENOMEM);

	strncpy(smack, string, i);

	return smack;
}

+0 −7
Original line number Diff line number Diff line
@@ -766,13 +766,6 @@ static int smack_set_mnt_opts(struct super_block *sb,
	if (sp->smk_flags & SMK_SB_INITIALIZED)
		return 0;

	if (inode->i_security == NULL) {
		int rc = lsm_inode_alloc(inode);

		if (rc)
			return rc;
	}

	if (!smack_privileged(CAP_MAC_ADMIN)) {
		/*
		 * Unprivileged mounts don't get to specify Smack values.