Skip to content

Commit

Permalink
Merge tag 'Smack-for-6.0' of https://github.com/cschaufler/smack-next
Browse files Browse the repository at this point in the history
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
  • Loading branch information
torvalds committed Aug 2, 2022
2 parents 1b6cf90 + aa16fb4 commit ea7099d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
7 changes: 2 additions & 5 deletions security/smack/smack_access.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
7 changes: 0 additions & 7 deletions security/smack/smack_lsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit ea7099d

Please sign in to comment.