Linux-audit Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/2] audit: change unnecessary globals into statics
       [not found] ` <20200803122430.82364-1-jbi.octave@gmail.com>
@ 2020-08-03 12:24   ` Jules Irenge
  2020-08-03 12:24   ` [PATCH 2/2] audit: uninitialize variable audit_sig_sid Jules Irenge
  1 sibling, 0 replies; 8+ messages in thread
From: Jules Irenge @ 2020-08-03 12:24 UTC (permalink / raw)
  To: inux-kernel; +Cc: Jules Irenge, moderated list:AUDIT SUBSYSTEM, open list

Variables sig_pid, audit_sig_uid and audit_sig_sid
are only used in the audit.c file across the kernel
Hence it appears no reason for declaring them as globals
This patch removes their global declarations from the .h file
and change them into static in the .c file.

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
 kernel/audit.c | 6 +++---
 kernel/audit.h | 4 ----
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index b2301bdc9773..afd7827cf6e8 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -123,9 +123,9 @@ static u32	audit_backlog_limit = 64;
 static u32	audit_backlog_wait_time = AUDIT_BACKLOG_WAIT_TIME;
 
 /* The identity of the user shutting down the audit system. */
-kuid_t		audit_sig_uid = INVALID_UID;
-pid_t		audit_sig_pid = -1;
-u32		audit_sig_sid = 0;
+static kuid_t		audit_sig_uid = INVALID_UID;
+static pid_t		audit_sig_pid = -1;
+static u32		audit_sig_sid = 0;
 
 /* Records can be lost in several ways:
    0) [suppressed in audit_alloc]
diff --git a/kernel/audit.h b/kernel/audit.h
index ddc22878433d..3b9c0945225a 100644
--- a/kernel/audit.h
+++ b/kernel/audit.h
@@ -327,10 +327,6 @@ static inline int audit_signal_info_syscall(struct task_struct *t)
 
 extern char *audit_unpack_string(void **bufp, size_t *remain, size_t len);
 
-extern pid_t audit_sig_pid;
-extern kuid_t audit_sig_uid;
-extern u32 audit_sig_sid;
-
 extern int audit_filter(int msgtype, unsigned int listtype);
 
 extern void audit_ctl_lock(void);
-- 
2.26.2

--
Linux-audit mailing list
Linux-audit@redhat.com
https://www.redhat.com/mailman/listinfo/linux-audit


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

* [PATCH 2/2] audit: uninitialize variable audit_sig_sid
       [not found] ` <20200803122430.82364-1-jbi.octave@gmail.com>
  2020-08-03 12:24   ` [PATCH 1/2] audit: change unnecessary globals into statics Jules Irenge
@ 2020-08-03 12:24   ` Jules Irenge
  1 sibling, 0 replies; 8+ messages in thread
From: Jules Irenge @ 2020-08-03 12:24 UTC (permalink / raw)
  To: inux-kernel; +Cc: Jules Irenge, moderated list:AUDIT SUBSYSTEM, open list

Checkpatch tool reports

"ERROR: do not initialise globals/statics to 0"

To fix this, audit_sig_sid is uninitialized
As this is stored in the .bss section,
the compiler can initialize the variable automatically.

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
 kernel/audit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index afd7827cf6e8..1c74d1d788b6 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -125,7 +125,7 @@ static u32	audit_backlog_wait_time = AUDIT_BACKLOG_WAIT_TIME;
 /* The identity of the user shutting down the audit system. */
 static kuid_t		audit_sig_uid = INVALID_UID;
 static pid_t		audit_sig_pid = -1;
-static u32		audit_sig_sid = 0;
+static u32		audit_sig_sid;
 
 /* Records can be lost in several ways:
    0) [suppressed in audit_alloc]
-- 
2.26.2

--
Linux-audit mailing list
Linux-audit@redhat.com
https://www.redhat.com/mailman/listinfo/linux-audit


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

* [RESEND PATCH 1/2] audit: change unnecessary globals into statics
       [not found] ` <20200803123439.83400-1-jbi.octave@gmail.com>
@ 2020-08-03 12:34   ` Jules Irenge
  2020-08-06 18:33     ` Paul Moore
  2020-08-03 12:34   ` [RESEND PATCH 2/2] audit: uninitialize variable audit_sig_sid Jules Irenge
  1 sibling, 1 reply; 8+ messages in thread
From: Jules Irenge @ 2020-08-03 12:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jules Irenge, moderated list:AUDIT SUBSYSTEM

Variables sig_pid, audit_sig_uid and audit_sig_sid
are only used in the audit.c file across the kernel
Hence it appears no reason for declaring them as globals
This patch removes their global declarations from the .h file
and change them into static in the .c file.

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
 kernel/audit.c | 6 +++---
 kernel/audit.h | 4 ----
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index b2301bdc9773..afd7827cf6e8 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -123,9 +123,9 @@ static u32	audit_backlog_limit = 64;
 static u32	audit_backlog_wait_time = AUDIT_BACKLOG_WAIT_TIME;
 
 /* The identity of the user shutting down the audit system. */
-kuid_t		audit_sig_uid = INVALID_UID;
-pid_t		audit_sig_pid = -1;
-u32		audit_sig_sid = 0;
+static kuid_t		audit_sig_uid = INVALID_UID;
+static pid_t		audit_sig_pid = -1;
+static u32		audit_sig_sid = 0;
 
 /* Records can be lost in several ways:
    0) [suppressed in audit_alloc]
diff --git a/kernel/audit.h b/kernel/audit.h
index ddc22878433d..3b9c0945225a 100644
--- a/kernel/audit.h
+++ b/kernel/audit.h
@@ -327,10 +327,6 @@ static inline int audit_signal_info_syscall(struct task_struct *t)
 
 extern char *audit_unpack_string(void **bufp, size_t *remain, size_t len);
 
-extern pid_t audit_sig_pid;
-extern kuid_t audit_sig_uid;
-extern u32 audit_sig_sid;
-
 extern int audit_filter(int msgtype, unsigned int listtype);
 
 extern void audit_ctl_lock(void);
-- 
2.26.2

--
Linux-audit mailing list
Linux-audit@redhat.com
https://www.redhat.com/mailman/listinfo/linux-audit


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

* [RESEND PATCH 2/2] audit: uninitialize variable audit_sig_sid
       [not found] ` <20200803123439.83400-1-jbi.octave@gmail.com>
  2020-08-03 12:34   ` [RESEND PATCH 1/2] audit: change unnecessary globals into statics Jules Irenge
@ 2020-08-03 12:34   ` Jules Irenge
  2020-08-06 18:35     ` Paul Moore
  1 sibling, 1 reply; 8+ messages in thread
From: Jules Irenge @ 2020-08-03 12:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jules Irenge, moderated list:AUDIT SUBSYSTEM

Checkpatch tool reports

"ERROR: do not initialise globals/statics to 0"

To fix this, audit_sig_sid is uninitialized
As this is stored in the .bss section,
the compiler can initialize the variable automatically.

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
 kernel/audit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index afd7827cf6e8..1c74d1d788b6 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -125,7 +125,7 @@ static u32	audit_backlog_wait_time = AUDIT_BACKLOG_WAIT_TIME;
 /* The identity of the user shutting down the audit system. */
 static kuid_t		audit_sig_uid = INVALID_UID;
 static pid_t		audit_sig_pid = -1;
-static u32		audit_sig_sid = 0;
+static u32		audit_sig_sid;
 
 /* Records can be lost in several ways:
    0) [suppressed in audit_alloc]
-- 
2.26.2

--
Linux-audit mailing list
Linux-audit@redhat.com
https://www.redhat.com/mailman/listinfo/linux-audit


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

* Re: [RESEND PATCH 1/2] audit: change unnecessary globals into statics
  2020-08-03 12:34   ` [RESEND PATCH 1/2] audit: change unnecessary globals into statics Jules Irenge
@ 2020-08-06 18:33     ` Paul Moore
  2020-08-18  0:38       ` Paul Moore
  0 siblings, 1 reply; 8+ messages in thread
From: Paul Moore @ 2020-08-06 18:33 UTC (permalink / raw)
  To: Jules Irenge; +Cc: moderated list:AUDIT SUBSYSTEM, linux-kernel

On Mon, Aug 3, 2020 at 8:35 AM Jules Irenge <jbi.octave@gmail.com> wrote:
>
> Variables sig_pid, audit_sig_uid and audit_sig_sid
> are only used in the audit.c file across the kernel
> Hence it appears no reason for declaring them as globals
> This patch removes their global declarations from the .h file
> and change them into static in the .c file.
>
> Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
> ---
>  kernel/audit.c | 6 +++---
>  kernel/audit.h | 4 ----
>  2 files changed, 3 insertions(+), 7 deletions(-)

Thanks Jules, this looks reasonable although I'm not going to merge
them into audit/next until after the merge window closes.  I'll send
another reply once this has been merged.

-- 
paul moore
www.paul-moore.com

--
Linux-audit mailing list
Linux-audit@redhat.com
https://www.redhat.com/mailman/listinfo/linux-audit


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

* Re: [RESEND PATCH 2/2] audit: uninitialize variable audit_sig_sid
  2020-08-03 12:34   ` [RESEND PATCH 2/2] audit: uninitialize variable audit_sig_sid Jules Irenge
@ 2020-08-06 18:35     ` Paul Moore
  2020-08-18  0:38       ` Paul Moore
  0 siblings, 1 reply; 8+ messages in thread
From: Paul Moore @ 2020-08-06 18:35 UTC (permalink / raw)
  To: Jules Irenge; +Cc: moderated list:AUDIT SUBSYSTEM, linux-kernel

On Mon, Aug 3, 2020 at 8:35 AM Jules Irenge <jbi.octave@gmail.com> wrote:
>
> Checkpatch tool reports
>
> "ERROR: do not initialise globals/statics to 0"
>
> To fix this, audit_sig_sid is uninitialized
> As this is stored in the .bss section,
> the compiler can initialize the variable automatically.
>
> Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
> ---
>  kernel/audit.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Similar to patch 1/2, this will need to wait until after the merge
window closes.

-- 
paul moore
www.paul-moore.com

--
Linux-audit mailing list
Linux-audit@redhat.com
https://www.redhat.com/mailman/listinfo/linux-audit


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

* Re: [RESEND PATCH 1/2] audit: change unnecessary globals into statics
  2020-08-06 18:33     ` Paul Moore
@ 2020-08-18  0:38       ` Paul Moore
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Moore @ 2020-08-18  0:38 UTC (permalink / raw)
  To: Jules Irenge; +Cc: moderated list:AUDIT SUBSYSTEM, linux-kernel

On Thu, Aug 6, 2020 at 2:33 PM Paul Moore <paul@paul-moore.com> wrote:
>
> On Mon, Aug 3, 2020 at 8:35 AM Jules Irenge <jbi.octave@gmail.com> wrote:
> >
> > Variables sig_pid, audit_sig_uid and audit_sig_sid
> > are only used in the audit.c file across the kernel
> > Hence it appears no reason for declaring them as globals
> > This patch removes their global declarations from the .h file
> > and change them into static in the .c file.
> >
> > Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
> > ---
> >  kernel/audit.c | 6 +++---
> >  kernel/audit.h | 4 ----
> >  2 files changed, 3 insertions(+), 7 deletions(-)
>
> Thanks Jules, this looks reasonable although I'm not going to merge
> them into audit/next until after the merge window closes.  I'll send
> another reply once this has been merged.

... and I just merged this into audit/next, thanks Jules.

-- 
paul moore
www.paul-moore.com

--
Linux-audit mailing list
Linux-audit@redhat.com
https://www.redhat.com/mailman/listinfo/linux-audit


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

* Re: [RESEND PATCH 2/2] audit: uninitialize variable audit_sig_sid
  2020-08-06 18:35     ` Paul Moore
@ 2020-08-18  0:38       ` Paul Moore
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Moore @ 2020-08-18  0:38 UTC (permalink / raw)
  To: Jules Irenge; +Cc: moderated list:AUDIT SUBSYSTEM, linux-kernel

On Thu, Aug 6, 2020 at 2:35 PM Paul Moore <paul@paul-moore.com> wrote:
>
> On Mon, Aug 3, 2020 at 8:35 AM Jules Irenge <jbi.octave@gmail.com> wrote:
> >
> > Checkpatch tool reports
> >
> > "ERROR: do not initialise globals/statics to 0"
> >
> > To fix this, audit_sig_sid is uninitialized
> > As this is stored in the .bss section,
> > the compiler can initialize the variable automatically.
> >
> > Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
> > ---
> >  kernel/audit.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Similar to patch 1/2, this will need to wait until after the merge
> window closes.

... also merged this patch into audit/next.  Thanks again.

-- 
paul moore
www.paul-moore.com

--
Linux-audit mailing list
Linux-audit@redhat.com
https://www.redhat.com/mailman/listinfo/linux-audit


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

end of thread, back to index

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <0/2>
     [not found] ` <20200803122430.82364-1-jbi.octave@gmail.com>
2020-08-03 12:24   ` [PATCH 1/2] audit: change unnecessary globals into statics Jules Irenge
2020-08-03 12:24   ` [PATCH 2/2] audit: uninitialize variable audit_sig_sid Jules Irenge
     [not found] ` <20200803123439.83400-1-jbi.octave@gmail.com>
2020-08-03 12:34   ` [RESEND PATCH 1/2] audit: change unnecessary globals into statics Jules Irenge
2020-08-06 18:33     ` Paul Moore
2020-08-18  0:38       ` Paul Moore
2020-08-03 12:34   ` [RESEND PATCH 2/2] audit: uninitialize variable audit_sig_sid Jules Irenge
2020-08-06 18:35     ` Paul Moore
2020-08-18  0:38       ` Paul Moore

Linux-audit Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-audit/0 linux-audit/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-audit linux-audit/ https://lore.kernel.org/linux-audit \
		linux-audit@redhat.com
	public-inbox-index linux-audit

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/com.redhat.linux-audit


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git