diff options
author | Namhyung Kim <namhyung@kernel.org> | 2014-06-14 12:19:01 -0400 |
---|---|---|
committer | Paul Moore <pmoore@redhat.com> | 2014-06-19 14:53:15 -0400 |
commit | f004afe60db5b98f2b981978fde8a0d4c6298c5d (patch) | |
tree | 3ffe2e1c455bc8cf2e5f43e9601347bec9758655 /security | |
parent | 4bb9398300a3a2c691e5c0ad6b9cfa78775e767e (diff) |
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: Namhyung Kim <namhyung@kernel.org>
(Minor tweak to the length parameter in the call to next_entry())
Signed-off-by: Paul Moore <pmoore@redhat.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/selinux/ss/conditional.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c index 377d148e7157..f09cc7268b65 100644 --- a/security/selinux/ss/conditional.c +++ b/security/selinux/ss/conditional.c | |||
@@ -402,19 +402,14 @@ static int cond_read_node(struct policydb *p, struct cond_node *node, void *fp) | |||
402 | int rc; | 402 | int rc; |
403 | struct cond_expr *expr = NULL, *last = NULL; | 403 | struct cond_expr *expr = NULL, *last = NULL; |
404 | 404 | ||
405 | rc = next_entry(buf, fp, sizeof(u32)); | 405 | rc = next_entry(buf, fp, sizeof(u32) * 2); |
406 | if (rc) | 406 | if (rc) |
407 | return rc; | 407 | return rc; |
408 | 408 | ||
409 | node->cur_state = le32_to_cpu(buf[0]); | 409 | node->cur_state = le32_to_cpu(buf[0]); |
410 | 410 | ||
411 | len = 0; | ||
412 | rc = next_entry(buf, fp, sizeof(u32)); | ||
413 | if (rc) | ||
414 | return rc; | ||
415 | |||
416 | /* expr */ | 411 | /* expr */ |
417 | len = le32_to_cpu(buf[0]); | 412 | len = le32_to_cpu(buf[1]); |
418 | 413 | ||
419 | for (i = 0; i < len; i++) { | 414 | for (i = 0; i < len; i++) { |
420 | rc = next_entry(buf, fp, sizeof(u32) * 2); | 415 | rc = next_entry(buf, fp, sizeof(u32) * 2); |