diff options
author | Ondrej Mosnacek <omosnace@redhat.com> | 2020-02-03 14:27:22 +0300 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2020-02-12 05:48:50 +0300 |
commit | 8794d7839038fc018e51d0afbf309b71069d9691 (patch) | |
tree | 59b3d0d407e36e0631abeee34558c0ed5e9b343e /security/selinux/ss/conditional.h | |
parent | 2b3a003e1543ab47b2f150abe31df4e7a3f8dde8 (diff) | |
download | linux-8794d7839038fc018e51d0afbf309b71069d9691.tar.xz |
selinux: convert cond_expr to array
Since it is fixed-size after allocation and we know the size beforehand,
using a plain old array is simpler and more efficient.
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Reviewed-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/selinux/ss/conditional.h')
-rw-r--r-- | security/selinux/ss/conditional.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/security/selinux/ss/conditional.h b/security/selinux/ss/conditional.h index 5f97f678440e..4677c6ff7450 100644 --- a/security/selinux/ss/conditional.h +++ b/security/selinux/ss/conditional.h @@ -19,7 +19,7 @@ * A conditional expression is a list of operators and operands * in reverse polish notation. */ -struct cond_expr { +struct cond_expr_node { #define COND_BOOL 1 /* plain bool */ #define COND_NOT 2 /* !bool */ #define COND_OR 3 /* bool || bool */ @@ -28,9 +28,13 @@ struct cond_expr { #define COND_EQ 6 /* bool == bool */ #define COND_NEQ 7 /* bool != bool */ #define COND_LAST COND_NEQ - __u32 expr_type; - __u32 bool; - struct cond_expr *next; + u32 expr_type; + u32 bool; +}; + +struct cond_expr { + struct cond_expr_node *nodes; + u32 len; }; /* @@ -52,7 +56,7 @@ struct cond_av_list { */ struct cond_node { int cur_state; - struct cond_expr *expr; + struct cond_expr expr; struct cond_av_list true_list; struct cond_av_list false_list; }; |