diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/auditsc.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index a371f857a0a9..c68229411a7c 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
| @@ -1034,21 +1034,15 @@ static inline void audit_free_aux(struct audit_context *context) | |||
| 1034 | } | 1034 | } |
| 1035 | } | 1035 | } |
| 1036 | 1036 | ||
| 1037 | static inline void audit_zero_context(struct audit_context *context, | ||
| 1038 | enum audit_state state) | ||
| 1039 | { | ||
| 1040 | memset(context, 0, sizeof(*context)); | ||
| 1041 | context->state = state; | ||
| 1042 | context->prio = state == AUDIT_RECORD_CONTEXT ? ~0ULL : 0; | ||
| 1043 | } | ||
| 1044 | |||
| 1045 | static inline struct audit_context *audit_alloc_context(enum audit_state state) | 1037 | static inline struct audit_context *audit_alloc_context(enum audit_state state) |
| 1046 | { | 1038 | { |
| 1047 | struct audit_context *context; | 1039 | struct audit_context *context; |
| 1048 | 1040 | ||
| 1049 | if (!(context = kmalloc(sizeof(*context), GFP_KERNEL))) | 1041 | context = kzalloc(sizeof(*context), GFP_KERNEL); |
| 1042 | if (!context) | ||
| 1050 | return NULL; | 1043 | return NULL; |
| 1051 | audit_zero_context(context, state); | 1044 | context->state = state; |
| 1045 | context->prio = state == AUDIT_RECORD_CONTEXT ? ~0ULL : 0; | ||
| 1052 | INIT_LIST_HEAD(&context->killed_trees); | 1046 | INIT_LIST_HEAD(&context->killed_trees); |
| 1053 | INIT_LIST_HEAD(&context->names_list); | 1047 | INIT_LIST_HEAD(&context->names_list); |
| 1054 | return context; | 1048 | return context; |
