diff options
author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2015-10-21 17:44:26 -0400 |
---|---|---|
committer | Paul Moore <pmoore@redhat.com> | 2015-10-21 17:44:26 -0400 |
commit | aa736c36db3e583d249e1d23a3ac9223b1c55f95 (patch) | |
tree | 52d40162fdeafd2b1bb4c51127416ca5ef71107a /security | |
parent | 20ba96aeebd40f09a1d626913235941e290992c7 (diff) |
selinux: use kmemdup in security_sid_to_context_core()
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Paul Moore <pmoore@redhat.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/selinux/ss/services.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index c550df0e0ff1..994c824a34c6 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c | |||
@@ -1259,12 +1259,12 @@ static int security_sid_to_context_core(u32 sid, char **scontext, | |||
1259 | *scontext_len = strlen(initial_sid_to_string[sid]) + 1; | 1259 | *scontext_len = strlen(initial_sid_to_string[sid]) + 1; |
1260 | if (!scontext) | 1260 | if (!scontext) |
1261 | goto out; | 1261 | goto out; |
1262 | scontextp = kmalloc(*scontext_len, GFP_ATOMIC); | 1262 | scontextp = kmemdup(initial_sid_to_string[sid], |
1263 | *scontext_len, GFP_ATOMIC); | ||
1263 | if (!scontextp) { | 1264 | if (!scontextp) { |
1264 | rc = -ENOMEM; | 1265 | rc = -ENOMEM; |
1265 | goto out; | 1266 | goto out; |
1266 | } | 1267 | } |
1267 | strcpy(scontextp, initial_sid_to_string[sid]); | ||
1268 | *scontext = scontextp; | 1268 | *scontext = scontextp; |
1269 | goto out; | 1269 | goto out; |
1270 | } | 1270 | } |