From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754164AbbI3QhV (ORCPT ); Wed, 30 Sep 2015 12:37:21 -0400 Received: from mail-qg0-f45.google.com ([209.85.192.45]:33778 "EHLO mail-qg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752547AbbI3QhU (ORCPT ); Wed, 30 Sep 2015 12:37:20 -0400 From: Paul Moore To: Rasmus Villemoes Cc: Stephen Smalley , Eric Paris , James Morris , "Serge E. Hallyn" , selinux@tycho.nsa.gov, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/5] selinux: use kmemdup in security_sid_to_context_core() Date: Wed, 30 Sep 2015 12:37:18 -0400 Message-ID: <3866077.CzkZjXbNak@sifl> User-Agent: KMail/4.14.10 (Linux/4.1.5-gentoo; KDE/4.14.12; x86_64; ; ) In-Reply-To: <1443220459-11042-4-git-send-email-linux@rasmusvillemoes.dk> References: <1443220459-11042-1-git-send-email-linux@rasmusvillemoes.dk> <1443220459-11042-4-git-send-email-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Saturday, September 26, 2015 12:34:17 AM Rasmus Villemoes wrote: > Signed-off-by: Rasmus Villemoes > --- > security/selinux/ss/services.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Applied. > 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, *scontext_len = strlen(initial_sid_to_string[sid]) + 1; > if (!scontext) > goto out; > - scontextp = kmalloc(*scontext_len, GFP_ATOMIC); > + scontextp = kmemdup(initial_sid_to_string[sid], > + *scontext_len, GFP_ATOMIC); > if (!scontextp) { > rc = -ENOMEM; > goto out; > } > - strcpy(scontextp, initial_sid_to_string[sid]); > *scontext = scontextp; > goto out; > } -- paul moore www.paul-moore.com