mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC][PATCH -tip] x86: audit.c remove unnecessary global arrays
@ 2009-05-13 18:51 Jaswinder Singh Rajput
  2009-05-13 19:42 ` [RFC][PATCH -tip] x86: audit.c remove unnecessary global arraysn Thomas Gleixner
  0 siblings, 1 reply; 3+ messages in thread
From: Jaswinder Singh Rajput @ 2009-05-13 18:51 UTC (permalink / raw)
  To: Ingo Molnar, Al Viro, x86 maintainers, LKML


ia32_dir_class[], ia32_write_class[], ia32_read_class[], ia32_chattr_class[]
and ia32_signal_class[] are used only by arch/x86/kernel/audit_64.c
which can be replace by local variables:

dir_class[], write_class[], read_class[], chattr_class[] and signal_class[]

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
 arch/x86/ia32/audit.c      |   25 -------------------------
 arch/x86/kernel/audit_64.c |   15 +++++----------
 2 files changed, 5 insertions(+), 35 deletions(-)

diff --git a/arch/x86/ia32/audit.c b/arch/x86/ia32/audit.c
index 5d7b381..ee8ce50 100644
--- a/arch/x86/ia32/audit.c
+++ b/arch/x86/ia32/audit.c
@@ -1,30 +1,5 @@
 #include <asm/unistd_32.h>
 
-unsigned ia32_dir_class[] = {
-#include <asm-generic/audit_dir_write.h>
-~0U
-};
-
-unsigned ia32_chattr_class[] = {
-#include <asm-generic/audit_change_attr.h>
-~0U
-};
-
-unsigned ia32_write_class[] = {
-#include <asm-generic/audit_write.h>
-~0U
-};
-
-unsigned ia32_read_class[] = {
-#include <asm-generic/audit_read.h>
-~0U
-};
-
-unsigned ia32_signal_class[] = {
-#include <asm-generic/audit_signal.h>
-~0U
-};
-
 int ia32_classify_syscall(unsigned syscall)
 {
 	switch (syscall) {
diff --git a/arch/x86/kernel/audit_64.c b/arch/x86/kernel/audit_64.c
index 06d3e5a..aede8d2 100644
--- a/arch/x86/kernel/audit_64.c
+++ b/arch/x86/kernel/audit_64.c
@@ -59,16 +59,11 @@ int audit_classify_syscall(int abi, unsigned syscall)
 static int __init audit_classes_init(void)
 {
 #ifdef CONFIG_IA32_EMULATION
-	extern __u32 ia32_dir_class[];
-	extern __u32 ia32_write_class[];
-	extern __u32 ia32_read_class[];
-	extern __u32 ia32_chattr_class[];
-	extern __u32 ia32_signal_class[];
-	audit_register_class(AUDIT_CLASS_WRITE_32, ia32_write_class);
-	audit_register_class(AUDIT_CLASS_READ_32, ia32_read_class);
-	audit_register_class(AUDIT_CLASS_DIR_WRITE_32, ia32_dir_class);
-	audit_register_class(AUDIT_CLASS_CHATTR_32, ia32_chattr_class);
-	audit_register_class(AUDIT_CLASS_SIGNAL_32, ia32_signal_class);
+	audit_register_class(AUDIT_CLASS_WRITE_32, write_class);
+	audit_register_class(AUDIT_CLASS_READ_32, read_class);
+	audit_register_class(AUDIT_CLASS_DIR_WRITE_32, dir_class);
+	audit_register_class(AUDIT_CLASS_CHATTR_32, chattr_class);
+	audit_register_class(AUDIT_CLASS_SIGNAL_32, signal_class);
 #endif
 	audit_register_class(AUDIT_CLASS_WRITE, write_class);
 	audit_register_class(AUDIT_CLASS_READ, read_class);
-- 
1.6.0.6




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

* Re: [RFC][PATCH -tip] x86: audit.c remove unnecessary global arraysn
  2009-05-13 18:51 [RFC][PATCH -tip] x86: audit.c remove unnecessary global arrays Jaswinder Singh Rajput
@ 2009-05-13 19:42 ` Thomas Gleixner
  2009-05-13 19:49   ` Jaswinder Singh Rajput
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2009-05-13 19:42 UTC (permalink / raw)
  To: Jaswinder Singh Rajput; +Cc: Ingo Molnar, Al Viro, x86 maintainers, LKML

On Thu, 14 May 2009, Jaswinder Singh Rajput wrote:
 
> ia32_dir_class[], ia32_write_class[], ia32_read_class[], ia32_chattr_class[]
> and ia32_signal_class[] are used only by arch/x86/kernel/audit_64.c
> which can be replace by local variables:
> 
> dir_class[], write_class[], read_class[], chattr_class[] and signal_class[]

Groan, it can be replaced by local variables, but it does not result
in the same functionality.

These audit classes are arrays of syscall numbers, which are different
for 32 and 64 bit. ia32/audit.c includes unistd_32.h not unistd.h for
exactly this reason.

Thanks,

	tglx

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

* Re: [RFC][PATCH -tip] x86: audit.c remove unnecessary global arraysn
  2009-05-13 19:42 ` [RFC][PATCH -tip] x86: audit.c remove unnecessary global arraysn Thomas Gleixner
@ 2009-05-13 19:49   ` Jaswinder Singh Rajput
  0 siblings, 0 replies; 3+ messages in thread
From: Jaswinder Singh Rajput @ 2009-05-13 19:49 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Ingo Molnar, Al Viro, x86 maintainers, LKML

On Wed, 2009-05-13 at 21:42 +0200, Thomas Gleixner wrote:
> On Thu, 14 May 2009, Jaswinder Singh Rajput wrote:
>  
> > ia32_dir_class[], ia32_write_class[], ia32_read_class[], ia32_chattr_class[]
> > and ia32_signal_class[] are used only by arch/x86/kernel/audit_64.c
> > which can be replace by local variables:
> > 
> > dir_class[], write_class[], read_class[], chattr_class[] and signal_class[]
> 
> Groan, it can be replaced by local variables, but it does not result
> in the same functionality.
> 
> These audit classes are arrays of syscall numbers, which are different
> for 32 and 64 bit. ia32/audit.c includes unistd_32.h not unistd.h for
> exactly this reason.
> 

Thanks, got it :-)

--
JSR


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

end of thread, other threads:[~2009-05-13 19:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-13 18:51 [RFC][PATCH -tip] x86: audit.c remove unnecessary global arrays Jaswinder Singh Rajput
2009-05-13 19:42 ` [RFC][PATCH -tip] x86: audit.c remove unnecessary global arraysn Thomas Gleixner
2009-05-13 19:49   ` Jaswinder Singh Rajput

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®