Commit 34c474de authored by Eric Paris's avatar Eric Paris

audit: fix build break when AUDIT_DEBUG == 2

Looks like this one has been around since 5195d8e2:

	kernel/auditsc.c: In function ‘audit_free_names’:
	kernel/auditsc.c:998: error: ‘i’ undeclared (first use in this function)

...and this warning:

	kernel/auditsc.c: In function ‘audit_putname’:
	kernel/auditsc.c:2045: warning: ‘i’ may be used uninitialized in this function
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarEric Paris <eparis@redhat.com>
parent 72199caa
...@@ -1001,6 +1001,8 @@ static inline void audit_free_names(struct audit_context *context) ...@@ -1001,6 +1001,8 @@ static inline void audit_free_names(struct audit_context *context)
#if AUDIT_DEBUG == 2 #if AUDIT_DEBUG == 2
if (context->put_count + context->ino_count != context->name_count) { if (context->put_count + context->ino_count != context->name_count) {
int i = 0;
printk(KERN_ERR "%s:%d(:%d): major=%d in_syscall=%d" printk(KERN_ERR "%s:%d(:%d): major=%d in_syscall=%d"
" name_count=%d put_count=%d" " name_count=%d put_count=%d"
" ino_count=%d [NOT freeing]\n", " ino_count=%d [NOT freeing]\n",
...@@ -1009,7 +1011,7 @@ static inline void audit_free_names(struct audit_context *context) ...@@ -1009,7 +1011,7 @@ static inline void audit_free_names(struct audit_context *context)
context->name_count, context->put_count, context->name_count, context->put_count,
context->ino_count); context->ino_count);
list_for_each_entry(n, &context->names_list, list) { 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->name ?: "(null)"); n->name, n->name->name ?: "(null)");
} }
dump_stack(); dump_stack();
...@@ -2050,10 +2052,10 @@ void audit_putname(struct filename *name) ...@@ -2050,10 +2052,10 @@ void audit_putname(struct filename *name)
__FILE__, __LINE__, context->serial, name); __FILE__, __LINE__, context->serial, name);
if (context->name_count) { if (context->name_count) {
struct audit_names *n; struct audit_names *n;
int i; int i = 0;
list_for_each_entry(n, &context->names_list, list) 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->name ?: "(null)"); n->name, n->name->name ?: "(null)");
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment