Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1236537

Re: [PATCH 4/5] selinux: use kstrdup() in security_get_bools()

From Paul Moore <paul@paul-moore.com>
Newsgroups linux.kernel
Subject Re: [PATCH 4/5] selinux: use kstrdup() in security_get_bools()
Date 2015-09-30 18:50 +0200
Message-ID <qesJR-2eW-33@gated-at.bofh.it> (permalink)
References <qcJON-6x2-3@gated-at.bofh.it> <qcJOP-6x2-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Saturday, September 26, 2015 12:34:18 AM Rasmus Villemoes wrote:
> This is much simpler.
> 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
>  security/selinux/ss/services.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)

Applied.

> 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:

-- 
paul moore
www.paul-moore.com

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] selinux: minor cleanup suggestions Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-09-26 00:40 +0200
  [PATCH 4/5] selinux: use kstrdup() in security_get_bools() Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-09-26 00:40 +0200
    Re: [PATCH 4/5] selinux: use kstrdup() in security_get_bools() Paul Moore <paul@paul-moore.com> - 2015-09-30 18:50 +0200
  Re: [PATCH 0/5] selinux: minor cleanup suggestions Stephen Smalley <sds@tycho.nsa.gov> - 2015-09-29 20:10 +0200

csiph-web