diff options
author | Rakib Mullick <rakib.mullick@gmail.com> | 2013-04-29 18:05:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 18:54:26 -0400 |
commit | 3f68613f39cdc242fa2e872ac04a802e7cc7b7cb (patch) | |
tree | 0e77f79e1051323fef9737b4ad52845182ad7e0a | |
parent | b5c5442bb6bce0c67701d55124be561043a51faf (diff) |
kernel/auditsc.c: use kzalloc instead of kmalloc+memset
In audit_alloc_context() use kzalloc instead of kmalloc+memset. Also
rename audit_zero_context() to audit_set_context(), to represent it's
inner workings properly.
[akpm@linux-foundation.org: remove audit_set_context() altogether - fold it into its caller]
Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Eric Paris <eparis@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-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; |