-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This patch looks good to me. acked. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk60AVMACgkQrlYvE4MpobNRHACeJ7YIbSg3nymdgaJpMk2y3vk6 u7wAnivsutaWlpmDLNyUFoMGZ7Mcork1 =ai25 -----END PGP SIGNATURE-----
>From d813ee07eecf057b321b43fed585688b2986bb2c Mon Sep 17 00:00:00 2001 From: Eric Paris <eparis@xxxxxxxxxx> Date: Thu, 3 Nov 2011 16:30:13 -0400 Subject: [PATCH 22/24] checkpolicy: dis* fixed signed vs unsigned errors A number of places we used unsigned variables and compared them against signed variables. This patch makes everything unsigned. Signed-off-by: Eric Paris <eparis@xxxxxxxxxx> --- checkpolicy/test/dismod.c | 18 +++++++++--------- checkpolicy/test/dispol.c | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/checkpolicy/test/dismod.c b/checkpolicy/test/dismod.c index 1674a47..0fe84c8 100644 --- a/checkpolicy/test/dismod.c +++ b/checkpolicy/test/dismod.c @@ -115,7 +115,7 @@ static void display_id(policydb_t * p, FILE * fp, uint32_t symbol_type, int display_type_set(type_set_t * set, uint32_t flags, policydb_t * policy, FILE * fp) { - int i, num_types; + unsigned int i, num_types; if (set->flags & TYPE_STAR) { fprintf(fp, " * "); @@ -178,7 +178,7 @@ int display_type_set(type_set_t * set, uint32_t flags, policydb_t * policy, int display_mod_role_set(role_set_t * roles, policydb_t * p, FILE * fp) { - int i, num = 0; + unsigned int i, num = 0; if (roles->flags & ROLE_STAR) { fprintf(fp, " * "); @@ -299,7 +299,7 @@ int display_type_callback(hashtab_key_t key, hashtab_datum_t datum, void *data) { type_datum_t *type; FILE *fp; - int i, first_attrib = 1; + unsigned int i, first_attrib = 1; type = (type_datum_t *) datum; fp = (FILE *) data; @@ -346,7 +346,7 @@ int display_types(policydb_t * p, FILE * fp) int display_users(policydb_t * p, FILE * fp) { - int i, j; + unsigned int i, j; ebitmap_t *bitmap; for (i = 0; i < p->p_users.nprim; i++) { display_id(p, fp, SYM_USERS, i, ""); @@ -365,7 +365,7 @@ int display_users(policydb_t * p, FILE * fp) int display_bools(policydb_t * p, FILE * fp) { - int i; + unsigned int i; for (i = 0; i < p->p_bools.nprim; i++) { display_id(p, fp, SYM_BOOLS, i, ""); @@ -462,7 +462,7 @@ void display_initial_sids(policydb_t * p, FILE * fp) void display_class_set(ebitmap_t *classes, policydb_t *p, FILE *fp) { - int i, num = 0; + unsigned int i, num = 0; for (i = ebitmap_startbit(classes); i < ebitmap_length(classes); i++) { if (!ebitmap_get_bit(classes, i)) @@ -538,9 +538,9 @@ int role_display_callback(hashtab_key_t key, hashtab_datum_t datum, void *data) static int display_scope_index(scope_index_t * indices, policydb_t * p, FILE * out_fp) { - int i; + unsigned int i; for (i = 0; i < SYM_NUM; i++) { - int any_found = 0, j; + unsigned int any_found = 0, j; fprintf(out_fp, "%s:", symbol_labels[i]); for (j = ebitmap_startbit(&indices->scope[i]); j < ebitmap_length(&indices->scope[i]); j++) { @@ -820,7 +820,7 @@ static void display_policycaps(policydb_t * p, FILE * fp) ebitmap_node_t *node; const char *capname; char buf[64]; - int i; + unsigned int i; fprintf(fp, "policy capabilities:\n"); ebitmap_for_each_bit(&p->policycaps, node, i) { diff --git a/checkpolicy/test/dispol.c b/checkpolicy/test/dispol.c index 0e08965..f41acdc 100644 --- a/checkpolicy/test/dispol.c +++ b/checkpolicy/test/dispol.c @@ -157,7 +157,7 @@ int render_av_rule(avtab_key_t * key, avtab_datum_t * datum, uint32_t what, int display_avtab(avtab_t * a, uint32_t what, policydb_t * p, FILE * fp) { - int i; + unsigned int i; avtab_ptr_t cur; avtab_t expa; @@ -184,7 +184,7 @@ int display_avtab(avtab_t * a, uint32_t what, policydb_t * p, FILE * fp) int display_bools(policydb_t * p, FILE * fp) { - int i; + unsigned int i; for (i = 0; i < p->p_bools.nprim; i++) { fprintf(fp, "%s : %d\n", p->p_bool_val_to_name[i], @@ -304,7 +304,7 @@ static void display_policycaps(policydb_t * p, FILE * fp) ebitmap_node_t *node; const char *capname; char buf[64]; - int i; + unsigned int i; fprintf(fp, "policy capabilities:\n"); ebitmap_for_each_bit(&p->policycaps, node, i) { @@ -329,7 +329,7 @@ static void display_id(policydb_t *p, FILE *fp, uint32_t symbol_type, static void display_permissive(policydb_t *p, FILE *fp) { ebitmap_node_t *node; - int i; + unsigned int i; fprintf(fp, "permissive sids:\n"); ebitmap_for_each_bit(&p->permissive_map, node, i) { -- 1.7.7.1