aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/ss/conditional.h
diff options
context:
space:
mode:
authorOndrej Mosnacek <omosnace@redhat.com>2020-02-03 12:27:22 +0100
committerPaul Moore <paul@paul-moore.com>2020-02-11 21:48:50 -0500
commit8794d7839038fc018e51d0afbf309b71069d9691 (patch)
tree59b3d0d407e36e0631abeee34558c0ed5e9b343e /security/selinux/ss/conditional.h
parentselinux: convert cond_av_list to array (diff)
downloadlinux-dev-8794d7839038fc018e51d0afbf309b71069d9691.tar.xz
linux-dev-8794d7839038fc018e51d0afbf309b71069d9691.zip
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 '')
-rw-r--r--security/selinux/ss/conditional.h14
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;
};