Skip to content

Commit

Permalink
audit: use memset instead of trying to initialize field by field
Browse files Browse the repository at this point in the history
We currently are setting fields to 0 to initialize the structure
declared on the stack.  This is a bad idea as if the structure has holes
or unpacked space these will not be initialized.  Just use memset.  This
is not a performance critical section of code.

Signed-off-by: Eric Paris <[email protected]>
  • Loading branch information
eparis committed Nov 5, 2013
1 parent 64fbff9 commit e13f91e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)

switch (msg_type) {
case AUDIT_GET:
status_set.mask = 0;
memset(&status_set, 0, sizeof(status_set));
status_set.enabled = audit_enabled;
status_set.failure = audit_failure;
status_set.pid = audit_pid;
Expand Down

0 comments on commit e13f91e

Please sign in to comment.