lkml.org 
[lkml]   [2015]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 4/5] selinux: use kstrdup() in security_get_bools()
From
Date
On 09/25/2015 06:34 PM, Rasmus Villemoes wrote:
> This is much simpler.
>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>

Acked-by: Stephen Smalley <sds@tycho.nsa.gov>

> ---
> security/selinux/ss/services.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
> index 994c824a34c6..aa2bdcb20848 100644
> --- a/security/selinux/ss/services.c
> +++ b/security/selinux/ss/services.c
> @@ -2609,18 +2609,12 @@ int security_get_bools(int *len, char ***names, int **values)
> goto err;
>
> for (i = 0; i < *len; i++) {
> - size_t name_len;
> -
> (*values)[i] = policydb.bool_val_to_struct[i]->state;
> - name_len = strlen(sym_name(&policydb, SYM_BOOLS, i)) + 1;
>
> rc = -ENOMEM;
> - (*names)[i] = kmalloc(sizeof(char) * name_len, GFP_ATOMIC);
> + (*names)[i] = kstrdup(sym_name(&policydb, SYM_BOOLS, i), GFP_ATOMIC);
> if (!(*names)[i])
> goto err;
> -
> - strncpy((*names)[i], sym_name(&policydb, SYM_BOOLS, i), name_len);
> - (*names)[i][name_len - 1] = 0;
> }
> rc = 0;
> out:
>



\
 
 \ /
  Last update: 2015-09-29 20:41    [W:0.884 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site