linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] audit: remove useless code in audit_enable
@ 2013-10-24  2:59 Gao feng
  2013-10-25 18:33 ` Richard Guy Briggs
  0 siblings, 1 reply; 4+ messages in thread
From: Gao feng @ 2013-10-24  2:59 UTC (permalink / raw)
  To: linux-audit; +Cc: linux-kernel, Gao feng

Since kernel parameter is operated before
initcall, so the audit_initialized must be
AUDIT_UNINITIALIZED or DISABLED in audit_enable.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
---
 kernel/audit.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index 50fdcba..b7269a4 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -927,17 +927,8 @@ static int __init audit_enable(char *str)
 	if (!audit_default)
 		audit_initialized = AUDIT_DISABLED;
 
-	printk(KERN_INFO "audit: %s", audit_default ? "enabled" : "disabled");
-
-	if (audit_initialized == AUDIT_INITIALIZED) {
-		audit_enabled = audit_default;
-		audit_ever_enabled |= !!audit_default;
-	} else if (audit_initialized == AUDIT_UNINITIALIZED) {
-		printk(" (after initialization)");
-	} else {
-		printk(" (until reboot)");
-	}
-	printk("\n");
+	printk(KERN_INFO "audit: %s\n", audit_default ?
+		"enabled (after initialization)" : "disabled (until reboot)");
 
 	return 1;
 }
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] audit: remove useless code in audit_enable
  2013-10-24  2:59 [PATCH] audit: remove useless code in audit_enable Gao feng
@ 2013-10-25 18:33 ` Richard Guy Briggs
  2013-10-31  6:31   ` [PATCH v2] " Gao feng
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Guy Briggs @ 2013-10-25 18:33 UTC (permalink / raw)
  To: Gao feng; +Cc: linux-audit, linux-kernel

On Thu, Oct 24, 2013 at 10:59:54AM +0800, Gao feng wrote:
> Since kernel parameter is operated before
> initcall, so the audit_initialized must be
> AUDIT_UNINITIALIZED or DISABLED in audit_enable.

Looks good, but should convert "printk(KERN_INFO " to "pr_info(".

> Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
> ---
>  kernel/audit.c | 13 ++-----------
>  1 file changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/kernel/audit.c b/kernel/audit.c
> index 50fdcba..b7269a4 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -927,17 +927,8 @@ static int __init audit_enable(char *str)
>  	if (!audit_default)
>  		audit_initialized = AUDIT_DISABLED;
>  
> -	printk(KERN_INFO "audit: %s", audit_default ? "enabled" : "disabled");
> -
> -	if (audit_initialized == AUDIT_INITIALIZED) {
> -		audit_enabled = audit_default;
> -		audit_ever_enabled |= !!audit_default;
> -	} else if (audit_initialized == AUDIT_UNINITIALIZED) {
> -		printk(" (after initialization)");
> -	} else {
> -		printk(" (until reboot)");
> -	}
> -	printk("\n");
> +	printk(KERN_INFO "audit: %s\n", audit_default ?
> +		"enabled (after initialization)" : "disabled (until reboot)");
>  
>  	return 1;
>  }

- RGB

--
Richard Guy Briggs <rbriggs@redhat.com>
Senior Software Engineer
Kernel Security
AMER ENG Base Operating Systems
Remote, Ottawa, Canada
Voice: +1.647.777.2635
Internal: (81) 32635
Alt: +1.613.693.0684x3545

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] audit: remove useless code in audit_enable
  2013-10-25 18:33 ` Richard Guy Briggs
@ 2013-10-31  6:31   ` Gao feng
  2013-10-31 15:22     ` Richard Guy Briggs
  0 siblings, 1 reply; 4+ messages in thread
From: Gao feng @ 2013-10-31  6:31 UTC (permalink / raw)
  To: linux-audit; +Cc: linux-kernel, rgb, Gao feng

Since kernel parameter is operated before
initcall, so the audit_initialized must be
AUDIT_UNINITIALIZED or DISABLED in audit_enable.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
---
 kernel/audit.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

change from v1:
convert "printk(KERN_INFO " to "pr_info(".
thanks Richard for pointing out.

diff --git a/kernel/audit.c b/kernel/audit.c
index 8378c5e..7c7c028 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1038,17 +1038,8 @@ static int __init audit_enable(char *str)
 	if (!audit_default)
 		audit_initialized = AUDIT_DISABLED;
 
-	printk(KERN_INFO "audit: %s", audit_default ? "enabled" : "disabled");
-
-	if (audit_initialized == AUDIT_INITIALIZED) {
-		audit_enabled = audit_default;
-		audit_ever_enabled |= !!audit_default;
-	} else if (audit_initialized == AUDIT_UNINITIALIZED) {
-		printk(" (after initialization)");
-	} else {
-		printk(" (until reboot)");
-	}
-	printk("\n");
+	pr_info("audit: %s\n", audit_default ?
+		"enabled (after initialization)" : "disabled (until reboot)");
 
 	return 1;
 }
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] audit: remove useless code in audit_enable
  2013-10-31  6:31   ` [PATCH v2] " Gao feng
@ 2013-10-31 15:22     ` Richard Guy Briggs
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Guy Briggs @ 2013-10-31 15:22 UTC (permalink / raw)
  To: Gao feng; +Cc: linux-audit, linux-kernel

On Thu, Oct 31, 2013 at 02:31:01PM +0800, Gao feng wrote:
> Since kernel parameter is operated before
> initcall, so the audit_initialized must be
> AUDIT_UNINITIALIZED or DISABLED in audit_enable.

I've queued this patch.  Thanks!

> Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
> ---
>  kernel/audit.c | 13 ++-----------
>  1 file changed, 2 insertions(+), 11 deletions(-)
> 
> change from v1:
> convert "printk(KERN_INFO " to "pr_info(".
> thanks Richard for pointing out.
> 
> diff --git a/kernel/audit.c b/kernel/audit.c
> index 8378c5e..7c7c028 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -1038,17 +1038,8 @@ static int __init audit_enable(char *str)
>  	if (!audit_default)
>  		audit_initialized = AUDIT_DISABLED;
>  
> -	printk(KERN_INFO "audit: %s", audit_default ? "enabled" : "disabled");
> -
> -	if (audit_initialized == AUDIT_INITIALIZED) {
> -		audit_enabled = audit_default;
> -		audit_ever_enabled |= !!audit_default;
> -	} else if (audit_initialized == AUDIT_UNINITIALIZED) {
> -		printk(" (after initialization)");
> -	} else {
> -		printk(" (until reboot)");
> -	}
> -	printk("\n");
> +	pr_info("audit: %s\n", audit_default ?
> +		"enabled (after initialization)" : "disabled (until reboot)");
>  
>  	return 1;
>  }
> -- 
> 1.8.3.1
> 

- RGB

--
Richard Guy Briggs <rbriggs@redhat.com>
Senior Software Engineer
Kernel Security
AMER ENG Base Operating Systems
Remote, Ottawa, Canada
Voice: +1.647.777.2635
Internal: (81) 32635
Alt: +1.613.693.0684x3545

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-31 15:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-24  2:59 [PATCH] audit: remove useless code in audit_enable Gao feng
2013-10-25 18:33 ` Richard Guy Briggs
2013-10-31  6:31   ` [PATCH v2] " Gao feng
2013-10-31 15:22     ` Richard Guy Briggs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).