[PATCH 1/2] audit: print error message when fail to create audit socket

Gao feng gaofeng at cn.fujitsu.com
Tue Dec 17 03:10:41 UTC 2013


print the error message and then return -ENOMEM.

Signed-off-by: Gao feng <gaofeng at cn.fujitsu.com>
---
 kernel/audit.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index 2a0ed0b..041b951 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1083,12 +1083,11 @@ static int __net_init audit_net_init(struct net *net)
 	pr_info("audit: initializing netlink socket in namespace\n");
 
 	aunet->nlsk = netlink_kernel_create(net, NETLINK_AUDIT, &cfg);
-	if (aunet->nlsk == NULL)
-		return -ENOMEM;
-	if (!aunet->nlsk)
+	if (aunet->nlsk == NULL) {
 		audit_panic("cannot initialize netlink socket in namespace");
-	else
-		aunet->nlsk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT;
+		return -ENOMEM;
+	}
+	aunet->nlsk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT;
 	return 0;
 }
 
-- 
1.8.3.1




More information about the Linux-audit mailing list