提交 ea7099d5 编写于 作者: L Linus Torvalds

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
...@@ -465,12 +465,9 @@ char *smk_parse_smack(const char *string, int len) ...@@ -465,12 +465,9 @@ char *smk_parse_smack(const char *string, int len)
if (i == 0 || i >= SMK_LONGLABEL) if (i == 0 || i >= SMK_LONGLABEL)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
smack = kzalloc(i + 1, GFP_NOFS); smack = kstrndup(string, i, GFP_NOFS);
if (smack == NULL) if (!smack)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
strncpy(smack, string, i);
return smack; return smack;
} }
......
...@@ -766,13 +766,6 @@ static int smack_set_mnt_opts(struct super_block *sb, ...@@ -766,13 +766,6 @@ static int smack_set_mnt_opts(struct super_block *sb,
if (sp->smk_flags & SMK_SB_INITIALIZED) if (sp->smk_flags & SMK_SB_INITIALIZED)
return 0; return 0;
if (inode->i_security == NULL) {
int rc = lsm_inode_alloc(inode);
if (rc)
return rc;
}
if (!smack_privileged(CAP_MAC_ADMIN)) { if (!smack_privileged(CAP_MAC_ADMIN)) {
/* /*
* Unprivileged mounts don't get to specify Smack values. * Unprivileged mounts don't get to specify Smack values.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册