diff options
Diffstat (limited to 'security/smack')
-rw-r--r-- | security/smack/smack_access.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/security/smack/smack_access.c b/security/smack/smack_access.c index d2186e2757be..585e5e35710b 100644 --- a/security/smack/smack_access.c +++ b/security/smack/smack_access.c @@ -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; } |