Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp40121pxb; Tue, 10 Nov 2020 19:06:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwysFvm53VSAOiFh+2Ttv8ld2fPjzLb1VZdFKCu14Qhz7z/dSb148tiO2v/gKg1BmRc3zy2 X-Received: by 2002:a17:906:77c5:: with SMTP id m5mr23366853ejn.424.1605064003885; Tue, 10 Nov 2020 19:06:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605064003; cv=none; d=google.com; s=arc-20160816; b=PGCyt5KZq2BzBWA8JuaZmxmqu/qAOQgELdOryzY2/bcv0tVSqhgy1y0y9hv4zg7+qA Mu+ZKaMTCx8E+PIs+k4qFrQGM9oLFrmI37kJwduFhzBLifvydn7XihD4ofUlgdd9ZJuY x9HQ/MGoozfL4SQHwaRxrgX8tafmVDZzPu8DuwKXXSDmYiSJc0q9wI+kjslvURqkohot Dsn229cbmjacDh53BbmezyZkGqSPlNeG+ymd3AmBH8vYChVN9msEFLXSQnhMcMIJbBgG N8iQ0XDUnjOAt+oLm9QHHMm9bYCEYktltowfB5RnZu03UnFCQqIcVJ6OKEVwGcDEvArS ygag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=kAI66A1HaDxdXVgcIi30SJI9zav2icPTlQ74GymTqFM=; b=kZB0W1+kbb1azf0jI+KU5umoVFxRnk1gib80BwlhL+aGQdbLw+cm0zHT+n30iwJCSE iWfD7LJh+Re4vnypJIG+ILuDNgZICnlDnMUj+zanmaQNJ3C52WB9fv8ctyLxcBgTwcz5 EkbmkTvVcgxPiO8cmKfc5oaK8zOhbA9CGYnzj2mCHUHRavkhKBk2mGS6oxZ1NwcLSfHG QwDWQAea142f94xp7MqynsAJu5U5UkJcKwuqUTtlGTsrhkO1ci8p29B3FDKb5ScMINls KCLj5/7LKvJc4sjtmkl/ZFUjFRsWJ5iHdVkdGUjhgqm07OU39d2kTuYHGvy9/WZPhHAF t++g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JLtV4Tzs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y99si497659ede.294.2020.11.10.19.06.19; Tue, 10 Nov 2020 19:06:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JLtV4Tzs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726041AbgKKDES (ORCPT + 99 others); Tue, 10 Nov 2020 22:04:18 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:50255 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725839AbgKKDES (ORCPT ); Tue, 10 Nov 2020 22:04:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605063856; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kAI66A1HaDxdXVgcIi30SJI9zav2icPTlQ74GymTqFM=; b=JLtV4Tzs9zEZ9w+MvmtI9W/DDWaflESieGNa2TyS1mJwA1p625aKVyYmSmNd+dYuzDAVLU U2iNAhKUUCcvdY1xn+AeCAL8yQF8q0zzASTIJqQKaK98Os3Otti+5xSEXZCKw3RsRwPS4h lq3Ugro2nHs17/5SqDB3wJB2yV8xONQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-32-rkwv_88sM-iTNM9HMofwwg-1; Tue, 10 Nov 2020 22:04:14 -0500 X-MC-Unique: rkwv_88sM-iTNM9HMofwwg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C8B5F5F9DB; Wed, 11 Nov 2020 03:04:13 +0000 (UTC) Received: from madcap2.tricolour.ca (unknown [10.10.110.8]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B82561002C09; Wed, 11 Nov 2020 03:04:01 +0000 (UTC) Date: Tue, 10 Nov 2020 22:03:59 -0500 From: Richard Guy Briggs To: Paul Moore Cc: Alex Shi , linux-audit@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] audit: remove unused macros Message-ID: <20201111030359.GB55072@madcap2.tricolour.ca> References: <1604651482-9780-1-git-send-email-alex.shi@linux.alibaba.com> <20201110152310.GB55411@madcap2.tricolour.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-11-10 21:47, Paul Moore wrote: > On Tue, Nov 10, 2020 at 10:23 AM Richard Guy Briggs 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 > > > Cc: Paul Moore > > > Cc: Eric Paris > > > 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 2005-05-13 > > ("AUDIT: Add message types to audit records") > > > > Introduced here: > > 8e633c3fb2a2 David Woodhouse 2005-03-01 > > ("Audit IPC object owner/permission changes.") > > > > I agree, remove it. > > No arguments from me. > > -- > paul moore - RGB -- Richard Guy Briggs 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