]> Pileus Git - ~andy/linux/commitdiff
audit: use memset instead of trying to initialize field by field
authorEric Paris <eparis@redhat.com>
Tue, 5 Nov 2013 15:48:02 +0000 (10:48 -0500)
committerEric Paris <eparis@redhat.com>
Tue, 5 Nov 2013 16:08:35 +0000 (11:08 -0500)
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 <eparis@redhat.com>
kernel/audit.c

index e0f7767e4a3d6bf02426836796b8756d5452153a..3ce60e063aae52a527a7ac47b69fdd16bc1904bf 100644 (file)
@@ -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;