From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Moody Subject: [PATCH] audit: missing variable declaration/initialization when AUDIT_DEBUG == 2. Date: Wed, 18 Jul 2012 14:30:41 -0700 Message-ID: <1342647041-13210-1-git-send-email-pmoody@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.17]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q6ILVDZ2018587 for ; Wed, 18 Jul 2012 17:31:13 -0400 Received: from mail-gh0-f174.google.com (mail-gh0-f174.google.com [209.85.160.174]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6ILVBxk000846 for ; Wed, 18 Jul 2012 17:31:11 -0400 Received: by ghrr11 with SMTP id r11so2371871ghr.33 for ; Wed, 18 Jul 2012 14:31:11 -0700 (PDT) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com To: linux-audit@redhat.com List-Id: linux-audit@redhat.com Additionally it looks like audit_free_names might return too early when AUDIT_DEBUG was set to 2. Signed-off-by: Peter Moody --- kernel/auditsc.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 4b96415..0c1db46 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -997,6 +997,7 @@ static inline void audit_free_names(struct audit_context *context) #if AUDIT_DEBUG == 2 if (context->put_count + context->ino_count != context->name_count) { + int i = 0; printk(KERN_ERR "%s:%d(:%d): major=%d in_syscall=%d" " name_count=%d put_count=%d" " ino_count=%d [NOT freeing]\n", @@ -1005,11 +1006,10 @@ static inline void audit_free_names(struct audit_context *context) context->name_count, context->put_count, context->ino_count); list_for_each_entry(n, &context->names_list, list) { - printk(KERN_ERR "names[%d] = %p = %s\n", i, + printk(KERN_ERR "names[%d] = %p = %s\n", i++, n->name, n->name ?: "(null)"); } dump_stack(); - return; } #endif #if AUDIT_DEBUG @@ -2084,10 +2084,10 @@ void audit_putname(const char *name) __FILE__, __LINE__, context->serial, name); if (context->name_count) { struct audit_names *n; - int i; + int i = 0; list_for_each_entry(n, &context->names_list, list) - printk(KERN_ERR "name[%d] = %p = %s\n", i, + printk(KERN_ERR "name[%d] = %p = %s\n", i++, n->name, n->name ?: "(null)"); } #endif -- 1.7.7.3