From: tmiller@tresys.com
To: selinux@tycho.nsa.gov
Cc: method@madmethod.com, sds@tycho.nsa.gov
Subject: [patch 5/7] quiet libsepol uninitialized variable warnings
Date: Thu, 03 Jan 2008 13:43:36 -0500 [thread overview]
Message-ID: <20080103184516.021126898@tresys.com> (raw)
In-Reply-To: 20080103184331.485176161@tresys.com
Fix some gcc warnings about uninitialized variables.
For genusers.c, BADLINE() was being used inside an inner
loop that prevented it from working for those two cases.
---
libsepol/src/genusers.c | 7 +++++--
libsepol/src/hierarchy.c | 11 ++++-------
2 files changed, 9 insertions(+), 9 deletions(-)
Index: trunk/libsepol/src/genusers.c
===================================================================
--- trunk.orig/libsepol/src/genusers.c
+++ trunk/libsepol/src/genusers.c
@@ -117,17 +117,18 @@ static int load_users(struct policydb *p
} else
islist = 0;
+ oldc = 0;
do {
while (*p && isspace(*p))
p++;
if (!(*p))
- BADLINE();
+ break;
q = p;
while (*p && *p != ';' && *p != '}' && !isspace(*p))
p++;
if (!(*p))
- BADLINE();
+ break;
if (*p == '}')
islist = 0;
oldc = *p;
@@ -153,6 +154,8 @@ static int load_users(struct policydb *p
}
}
} while (islist);
+ if (oldc == 0)
+ BADLINE();
if (policydb->mls) {
context_struct_t context;
Index: trunk/libsepol/src/hierarchy.c
===================================================================
--- trunk.orig/libsepol/src/hierarchy.c
+++ trunk/libsepol/src/hierarchy.c
@@ -130,7 +130,7 @@ static int check_avtab_hierarchy_callbac
avtab_key_t key;
avtab_datum_t *avdatump;
hierarchy_args_t *a;
- uint32_t av;
+ uint32_t av = 0;
type_datum_t *t = NULL, *t2 = NULL;
if (!(k->specified & AVTAB_ALLOWED)) {
@@ -164,8 +164,7 @@ static int check_avtab_hierarchy_callbac
return 0;
}
av = avdatump->data;
- } else
- av = 0;
+ }
if (a->opt_cond_list) {
/* if a conditional list is present search it before continuing */
avdatump = cond_av_list_search(&key, a->opt_cond_list);
@@ -202,8 +201,7 @@ static int check_avtab_hierarchy_callbac
return 0;
}
av = avdatump->data;
- } else
- av = 0;
+ }
if (a->opt_cond_list) {
/* if a conditional list is present search it before continuing */
avdatump = cond_av_list_search(&key, a->opt_cond_list);
@@ -228,8 +226,7 @@ static int check_avtab_hierarchy_callbac
return 0;
}
av = avdatump->data;
- } else
- av = 0;
+ }
if (a->opt_cond_list) {
/* if a conditional list is present search it before continuing */
avdatump = cond_av_list_search(&key, a->opt_cond_list);
--
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
next prev parent reply other threads:[~2008-01-03 18:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-03 18:43 [patch 0/7] quiet gcc warnings tmiller
2008-01-03 18:43 ` [patch 1/7] quiet checkpolicy warnings tmiller
2008-01-03 18:43 ` [patch 2/7] quiet libsepol qualifier warnings tmiller
2008-01-03 18:43 ` [patch 3/7] quiet getdefaultcon warning tmiller
2008-01-03 18:43 ` [patch 4/7] quiet libsemanage scanner warnings tmiller
2008-01-03 18:43 ` tmiller [this message]
2008-01-03 18:43 ` [patch 6/7] quiet policycoreutils warnings tmiller
2008-01-03 18:43 ` [patch 7/7] Use -Werror tmiller
2008-01-07 18:06 ` Stephen Smalley
2008-01-07 18:30 ` Joshua Brindle
2008-01-07 18:50 ` Stephen Smalley
2008-01-09 18:47 ` [patch 0/7] quiet gcc warnings Todd Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080103184516.021126898@tresys.com \
--to=tmiller@tresys.com \
--cc=method@madmethod.com \
--cc=sds@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.