Commit f004afe6 authored by Namhyung Kim's avatar Namhyung Kim Committed by Paul Moore

selinux: simple cleanup for cond_read_node()

The node->cur_state and len can be read in a single call of next_entry().
And setting len before reading is a dead write so can be eliminated.
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
(Minor tweak to the length parameter in the call to next_entry())
Signed-off-by: default avatarPaul Moore <pmoore@redhat.com>
parent 4bb93983
...@@ -402,19 +402,14 @@ static int cond_read_node(struct policydb *p, struct cond_node *node, void *fp) ...@@ -402,19 +402,14 @@ static int cond_read_node(struct policydb *p, struct cond_node *node, void *fp)
int rc; int rc;
struct cond_expr *expr = NULL, *last = NULL; struct cond_expr *expr = NULL, *last = NULL;
rc = next_entry(buf, fp, sizeof(u32)); rc = next_entry(buf, fp, sizeof(u32) * 2);
if (rc) if (rc)
return rc; return rc;
node->cur_state = le32_to_cpu(buf[0]); node->cur_state = le32_to_cpu(buf[0]);
len = 0;
rc = next_entry(buf, fp, sizeof(u32));
if (rc)
return rc;
/* expr */ /* expr */
len = le32_to_cpu(buf[0]); len = le32_to_cpu(buf[1]);
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
rc = next_entry(buf, fp, sizeof(u32) * 2); rc = next_entry(buf, fp, sizeof(u32) * 2);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment