[PATCH] cleanup audit name handling

Amy Griffis amy.griffis at hp.com
Tue Nov 29 22:55:53 UTC 2005


Cleanup handling of name field: "(null)" is a legit filename, so don't
use it for a placeholder.

Signed-off-by: Amy Griffis <amy.griffis at hp.com>


diff --git a/kernel/auditsc.c b/kernel/auditsc.c
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -751,7 +751,7 @@ static inline void audit_free_names(stru
 		for (i = 0; i < context->name_count; i++) {
 			printk(KERN_ERR "names[%d] = %p = %s\n", i,
 			       context->names[i].name,
-			       context->names[i].name ?: "(null)");
+			       context->names[i].name ?: "");
 			kfree(context->names[i].ctx);
 		}
 		dump_stack();
@@ -1025,11 +1025,10 @@ static void audit_log_exit(struct audit_
 
 		audit_log_format(ab, "item=%d", i);
 
-		audit_log_format(ab, " name=");
-		if (context->names[i].name)
+		if (context->names[i].name) {
+			audit_log_format(ab, " name=");
 			audit_log_untrustedstring(ab, context->names[i].name);
-		else
-			audit_log_format(ab, "(null)");
+		}
 
 		if (pino != (unsigned long)-1)
 			audit_log_format(ab, " parent=%lu",  pino);
@@ -1275,7 +1274,7 @@ void audit_putname(const char *name)
 			for (i = 0; i < context->name_count; i++)
 				printk(KERN_ERR "name[%d] = %p = %s\n", i,
 				       context->names[i].name,
-				       context->names[i].name ?: "(null)");
+				       context->names[i].name ?: "");
 		}
 #endif
 		__putname(name);




More information about the Linux-audit mailing list