public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 5/7] selinux: fix error codes in cond_policydb_init()
@ 2010-06-07 21:08 Dan Carpenter
  2010-06-08 20:20 ` Eric Paris
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-06-07 21:08 UTC (permalink / raw)
  To: kernel-janitors

It's better to propagate the error code from avtab_init() instead of
returning -1 (-EPERM).  It turns out that avtab_init() never fails so
this patch doesn't change how the code runs but it's still a clean up.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c
index f0de637..7447be0 100644
--- a/security/selinux/ss/conditional.c
+++ b/security/selinux/ss/conditional.c
@@ -117,10 +117,14 @@ int evaluate_cond_node(struct policydb *p, struct cond_node *node)
 
 int cond_policydb_init(struct policydb *p)
 {
+	int ret;
+
 	p->bool_val_to_struct = NULL;
 	p->cond_list = NULL;
-	if (avtab_init(&p->te_cond_avtab))
-		return -1;
+
+	ret = avtab_init(&p->te_cond_avtab);
+	if (ret < 0)
+		return ret;
 
 	return 0;
 }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch 5/7] selinux: fix error codes in cond_policydb_init()
  2010-06-07 21:08 [patch 5/7] selinux: fix error codes in cond_policydb_init() Dan Carpenter
@ 2010-06-08 20:20 ` Eric Paris
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Paris @ 2010-06-08 20:20 UTC (permalink / raw)
  To: kernel-janitors

On Mon, Jun 7, 2010 at 5:08 PM, Dan Carpenter <error27@gmail.com> wrote:
> It's better to propagate the error code from avtab_init() instead of
> returning -1 (-EPERM).  It turns out that avtab_init() never fails so
> this patch doesn't change how the code runs but it's still a clean up.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c
> index f0de637..7447be0 100644
> --- a/security/selinux/ss/conditional.c
> +++ b/security/selinux/ss/conditional.c
> @@ -117,10 +117,14 @@ int evaluate_cond_node(struct policydb *p, struct cond_node *node)
>
>  int cond_policydb_init(struct policydb *p)
>  {
> +       int ret;

I know, I'm being pedantic, but int rc, not int ret;  All of the rest
of the code uses rc.

> +
>        p->bool_val_to_struct = NULL;
>        p->cond_list = NULL;
> -       if (avtab_init(&p->te_cond_avtab))
> -               return -1;
> +
> +       ret = avtab_init(&p->te_cond_avtab);
> +       if (ret < 0)

if (rc)   not if (rc < 0)


> +               return ret;
>
>        return 0;
>  }

-Eric
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-08 20:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-07 21:08 [patch 5/7] selinux: fix error codes in cond_policydb_init() Dan Carpenter
2010-06-08 20:20 ` Eric Paris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox