Skip to contentSkip to conversation

policy_define.c: fix compiler warnings

PATCH Applied Nick Kralevich 3 participants 3 messages Jun 13, 2015 – Jun 15, 2015 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 policy_define.c: fix compiler warnings

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)) \
                                             ^ ~~~~~~~~~~~~~~~~~
---
 checkpolicy/policy_define.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
checkpolicy/policy_define.c +3 -2
index 093bded..27d8fe7 100644
@@ -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)
Signature · 1 line
2.2.0.rc0.207.ga3a616c
Acked-by on v1 1/1
#1 lore raw
Quoted 46 lines · Nick Kralevich

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)) \
                                             ^ ~~~~~~~~~~~~~~~~~
---
 checkpolicy/policy_define.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
checkpolicy/policy_define.c +3 -3
index 093bded..27d8fe7 100644
@@ -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
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].

#2 lore raw
In reply to Nick Kralevich
Quoted 11 lines · Nick Kralevich

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)) \
                                             ^ ~~~~~~~~~~~~~~~~~

Thanks, applied.

Quoted 28 lines
---
 checkpolicy/policy_define.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
checkpolicy/policy_define.c +3 -2
index 093bded..27d8fe7 100644
@@ -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)