Skip to content

Commit

Permalink
selinux: simple cleanup for cond_read_node()
Browse files Browse the repository at this point in the history
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: Namhyung Kim <[email protected]>
(Minor tweak to the length parameter in the call to next_entry())
Signed-off-by: Paul Moore <[email protected]>

Signed-off-by: franciscofranco <[email protected]>
  • Loading branch information
namhyung authored and DerRomtester committed Sep 21, 2016
1 parent f43fdd8 commit 6d43ba6
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions security/selinux/ss/conditional.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,19 +403,14 @@ static int cond_read_node(struct policydb *p, struct cond_node *node, void *fp)
int rc;
struct cond_expr *expr = NULL, *last = NULL;

rc = next_entry(buf, fp, sizeof(u32));
rc = next_entry(buf, fp, sizeof(u32) * 2);
if (rc)
return rc;

node->cur_state = le32_to_cpu(buf[0]);

len = 0;
rc = next_entry(buf, fp, sizeof(u32));
if (rc)
return rc;

/* expr */
len = le32_to_cpu(buf[0]);
len = le32_to_cpu(buf[1]);

for (i = 0; i < len; i++) {
rc = next_entry(buf, fp, sizeof(u32) * 2);
Expand Down

0 comments on commit 6d43ba6

Please sign in to comment.