All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] policy_define.c: fix compiler warnings
@ 2015-06-13 14:49 Nick Kralevich
  2015-06-14 20:33 ` Jeffrey Vander Stoep
  2015-06-15 13:34 ` Stephen Smalley
  0 siblings, 2 replies; 3+ messages in thread
From: Nick Kralevich @ 2015-06-13 14:49 UTC (permalink / raw)
  To: selinux

Fixes compiler warnings all similar to the following:

host C: checkpolicy <= external/selinux/checkpolicy/policy_define.c
external/selinux/checkpolicy/policy_define.c:1572:2: warning: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Wsign-compare]
        ebitmap_for_each_bit(&tclasses, node, i) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/selinux/checkpolicy/../libsepol/include/sepol/policydb/ebitmap.h:76:39: note: expanded from macro 'ebitmap_for_each_bit'
        for (bit = ebitmap_start(e, &n); bit < ebitmap_length(e); bit = ebitmap_next(&n, bit)) \
                                             ^ ~~~~~~~~~~~~~~~~~

Signed-off-by: Nick Kralevich <nnk@google.com>
---
 checkpolicy/policy_define.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
index 093bded..27d8fe7 100644
--- a/checkpolicy/policy_define.c
+++ b/checkpolicy/policy_define.c
@@ -1521,7 +1521,8 @@ int define_compute_type_helper(int which, avrule_t ** rule)
 	ebitmap_node_t *node;
 	avrule_t *avrule;
 	class_perm_node_t *perm;
-	int i, add = 1;
+	uint32_t i;
+	int add = 1;
 
 	avrule = malloc(sizeof(avrule_t));
 	if (!avrule) {
@@ -2745,7 +2746,7 @@ static int dominate_role_recheck(hashtab_key_t key __attribute__ ((unused)),
 	role_datum_t *rdp = (role_datum_t *) arg;
 	role_datum_t *rdatum = (role_datum_t *) datum;
 	ebitmap_node_t *node;
-	int i;
+	uint32_t i;
 
 	/* Don't bother to process against self role */
 	if (rdatum->s.value == rdp->s.value)
-- 
2.2.0.rc0.207.ga3a616c

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

* Re: [PATCH] policy_define.c: fix compiler warnings
  2015-06-13 14:49 [PATCH] policy_define.c: fix compiler warnings Nick Kralevich
@ 2015-06-14 20:33 ` Jeffrey Vander Stoep
  2015-06-15 13:34 ` Stephen Smalley
  1 sibling, 0 replies; 3+ messages in thread
From: Jeffrey Vander Stoep @ 2015-06-14 20:33 UTC (permalink / raw)
  To: Nick Kralevich; +Cc: SELinux

Acked-by: Jeff Vander Stoep <jeffv@google.com>

On Sat, Jun 13, 2015 at 7:49 AM, Nick Kralevich <nnk@google.com> wrote:
> Fixes compiler warnings all similar to the following:
>
> host C: checkpolicy <= external/selinux/checkpolicy/policy_define.c
> external/selinux/checkpolicy/policy_define.c:1572:2: warning: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Wsign-compare]
>         ebitmap_for_each_bit(&tclasses, node, i) {
>         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> external/selinux/checkpolicy/../libsepol/include/sepol/policydb/ebitmap.h:76:39: note: expanded from macro 'ebitmap_for_each_bit'
>         for (bit = ebitmap_start(e, &n); bit < ebitmap_length(e); bit = ebitmap_next(&n, bit)) \
>                                              ^ ~~~~~~~~~~~~~~~~~
>
> Signed-off-by: Nick Kralevich <nnk@google.com>
> ---
>  checkpolicy/policy_define.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
> index 093bded..27d8fe7 100644
> --- a/checkpolicy/policy_define.c
> +++ b/checkpolicy/policy_define.c
> @@ -1521,7 +1521,8 @@ int define_compute_type_helper(int which, avrule_t ** rule)
>         ebitmap_node_t *node;
>         avrule_t *avrule;
>         class_perm_node_t *perm;
> -       int i, add = 1;
> +       uint32_t i;
> +       int add = 1;
>
>         avrule = malloc(sizeof(avrule_t));
>         if (!avrule) {
> @@ -2745,7 +2746,7 @@ static int dominate_role_recheck(hashtab_key_t key __attribute__ ((unused)),
>         role_datum_t *rdp = (role_datum_t *) arg;
>         role_datum_t *rdatum = (role_datum_t *) datum;
>         ebitmap_node_t *node;
> -       int i;
> +       uint32_t i;
>
>         /* Don't bother to process against self role */
>         if (rdatum->s.value == rdp->s.value)
> --
> 2.2.0.rc0.207.ga3a616c
>
> _______________________________________________
> Selinux mailing list
> Selinux@tycho.nsa.gov
> To unsubscribe, send email to Selinux-leave@tycho.nsa.gov.
> To get help, send an email containing "help" to Selinux-request@tycho.nsa.gov.

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

* Re: [PATCH] policy_define.c: fix compiler warnings
  2015-06-13 14:49 [PATCH] policy_define.c: fix compiler warnings Nick Kralevich
  2015-06-14 20:33 ` Jeffrey Vander Stoep
@ 2015-06-15 13:34 ` Stephen Smalley
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Smalley @ 2015-06-15 13:34 UTC (permalink / raw)
  To: Nick Kralevich, selinux

On 06/13/2015 10:49 AM, Nick Kralevich wrote:
> Fixes compiler warnings all similar to the following:
> 
> host C: checkpolicy <= external/selinux/checkpolicy/policy_define.c
> external/selinux/checkpolicy/policy_define.c:1572:2: warning: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Wsign-compare]
>         ebitmap_for_each_bit(&tclasses, node, i) {
>         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> external/selinux/checkpolicy/../libsepol/include/sepol/policydb/ebitmap.h:76:39: note: expanded from macro 'ebitmap_for_each_bit'
>         for (bit = ebitmap_start(e, &n); bit < ebitmap_length(e); bit = ebitmap_next(&n, bit)) \
>                                              ^ ~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Nick Kralevich <nnk@google.com>

Thanks, applied.

> ---
>  checkpolicy/policy_define.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
> index 093bded..27d8fe7 100644
> --- a/checkpolicy/policy_define.c
> +++ b/checkpolicy/policy_define.c
> @@ -1521,7 +1521,8 @@ int define_compute_type_helper(int which, avrule_t ** rule)
>  	ebitmap_node_t *node;
>  	avrule_t *avrule;
>  	class_perm_node_t *perm;
> -	int i, add = 1;
> +	uint32_t i;
> +	int add = 1;
>  
>  	avrule = malloc(sizeof(avrule_t));
>  	if (!avrule) {
> @@ -2745,7 +2746,7 @@ static int dominate_role_recheck(hashtab_key_t key __attribute__ ((unused)),
>  	role_datum_t *rdp = (role_datum_t *) arg;
>  	role_datum_t *rdatum = (role_datum_t *) datum;
>  	ebitmap_node_t *node;
> -	int i;
> +	uint32_t i;
>  
>  	/* Don't bother to process against self role */
>  	if (rdatum->s.value == rdp->s.value)
> 

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

end of thread, other threads:[~2015-06-15 13:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-13 14:49 [PATCH] policy_define.c: fix compiler warnings Nick Kralevich
2015-06-14 20:33 ` Jeffrey Vander Stoep
2015-06-15 13:34 ` Stephen Smalley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.