Messages in this thread | | | Date | Tue, 10 Nov 2020 22:03:59 -0500 | From | Richard Guy Briggs <> | Subject | Re: [PATCH] audit: remove unused macros |
| |
On 2020-11-10 21:47, Paul Moore wrote: > On Tue, Nov 10, 2020 at 10:23 AM Richard Guy Briggs <rgb@redhat.com> wrote: > > On 2020-11-06 16:31, Alex Shi wrote: > > > Some unused macros could cause gcc warning: > > > kernel/audit.c:68:0: warning: macro "AUDIT_UNINITIALIZED" is not used > > > [-Wunused-macros] > > > kernel/auditsc.c:104:0: warning: macro "AUDIT_AUX_IPCPERM" is not used > > > [-Wunused-macros] > > > kernel/auditsc.c:82:0: warning: macro "AUDITSC_INVALID" is not used > > > [-Wunused-macros] > > > > > > remove them to tame gcc. > > > > > > Signed-off-by: Alex Shi <alex.shi@linux.alibaba.com> > > > Cc: Paul Moore <paul@paul-moore.com> > > > Cc: Eric Paris <eparis@redhat.com> > > > Cc: linux-audit@redhat.com > > > Cc: linux-kernel@vger.kernel.org > > > --- > > > kernel/audit.c | 1 - > > > kernel/auditsc.c | 3 --- > > > 2 files changed, 4 deletions(-) > > > > > > diff --git a/kernel/audit.c b/kernel/audit.c > > > index ac0aeaa99937..dfac1e0ca887 100644 > > > --- a/kernel/audit.c > > > +++ b/kernel/audit.c > > > @@ -65,7 +65,6 @@ > > > /* No auditing will take place until audit_initialized == AUDIT_INITIALIZED. > > > * (Initialization happens after skb_init is called.) */ > > > #define AUDIT_DISABLED -1 > > > -#define AUDIT_UNINITIALIZED 0 > > > #define AUDIT_INITIALIZED 1 > > > static int audit_initialized; > > > > This one is part of a set, so it feels like it should stay, but the code > > is structured in such a way that it is not necessary. > > Yes, I'd like for us to find a way to keep this if possible. Let's > simply initialize "audit_initialized" to AUDIT_UNINITIALIZED in this > file. At some point someone will surely complain about not needing to > initialize to zero, but we can deal with that later.
We could change them to an enum of 1,2,3. ;-)
> > > diff --git a/kernel/auditsc.c b/kernel/auditsc.c > > > index 183d79cc2e12..eeb4930d499f 100644 > > > --- a/kernel/auditsc.c > > > +++ b/kernel/auditsc.c > > > @@ -80,7 +80,6 @@ > > > #include "audit.h" > > > > > > /* flags stating the success for a syscall */ > > > -#define AUDITSC_INVALID 0 > > > #define AUDITSC_SUCCESS 1 > > > #define AUDITSC_FAILURE 2 > > > > Same here, but this one should really be fixed by using > > AUDITSC_INVALID as the value assigned to context->return_valid in > > __audit_free() to avoid using magic numbers. > > Agreed. > > We could probably explicitly set it in audit_alloc_context() as well > if we wanted to be complete.
Agreed.
> > Similarly, the compared > > values in audit_filter_rules() under the AUDIT_EXIT and AUDIT_SUCCESS > > cases should be "ctx->return_valid != AUDITSC_INVALID" rather than just > > "ctx->return_valid". Same in audit_log_exit(). > > Agreed. > > > > @@ -102,8 +101,6 @@ struct audit_aux_data { > > > int type; > > > }; > > > > > > -#define AUDIT_AUX_IPCPERM 0 > > > - > > > > Hmmm, this one looks like it was orphaned 15 years ago a couple of > > months after it was introduced due to this commit: > > c04049939f88 Steve Grubb <sgrubb@redhat.com> 2005-05-13 > > ("AUDIT: Add message types to audit records") > > > > Introduced here: > > 8e633c3fb2a2 David Woodhouse <dwmw2@shinybook.infradead.org> 2005-03-01 > > ("Audit IPC object owner/permission changes.") > > > > I agree, remove it. > > No arguments from me. > > -- > paul moore
- RGB
-- Richard Guy Briggs <rgb@redhat.com> Sr. S/W Engineer, Kernel Security, Base Operating Systems Remote, Ottawa, Red Hat Canada IRC: rgb, SunRaycer Voice: +1.647.777.2635, Internal: (81) 32635
| |