Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3635878pxf; Mon, 22 Mar 2021 11:03:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6l5PIZinBfH5kPsSPBbYRM6gHiDlV7d4Zqt6BMjlYS0AppwFEEUN0NTJ1cn07jLrRcZGv X-Received: by 2002:aa7:df84:: with SMTP id b4mr866318edy.240.1616436226393; Mon, 22 Mar 2021 11:03:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616436226; cv=none; d=google.com; s=arc-20160816; b=c3RidGfTPcxJla4iPQGcvpY286S2u83hD8bt2azniDalz/D01DV+1pa8YePUCRGh7K ecej8PQgr6JswbmdH9idV9jKKm62+fPuwNSZbfiiQdFpN6lQSkoyUQKwpoiZH6zD5qgA nfBmY3qVkzggMvDllsp7/6ejhO5kWRl9SAQXBlvEOvyRRnuJf7OcvWeHG68OWbLrLCii 8r/VQOFMhuEDvpkDUHY9dDv1RShN7KLoS4yJ/XG2mrZHxX8nss3/D2YD7yue6JwcokUK M/dMQGA5Xhlx1Uf/NzL9bMS5ICtLlq2pA4O/9K8E0M3Uj8EJaZiTCT9msZvs6reRY/eg hxXg== 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=20BQI+v76FGYKrR9SYXiHB1x/TtE4NUd6bjBJmSu1sw=; b=sm5skzucAcy44OGDzgte2UwUjSURtsOjptHqEj6gcz/oyXQ0ZSZSwdBCiBOdMNYIg3 XbcAMG54EY4s21YgXs1r9woLkm9chwk9899rJs42pcSCfHzTbBO0urrbeKNNTdHglXf4 0MFD3Zkl3U/A+mVMagz5fw4V7W3YJ8GM/amnJA2osZKfcaDVjkxo1shu/QAKwwW/SzCn ikDMbGptm1IOID9WkQSmtsZTSuD7vy+03uf365iR5nrurOU1XBcab+Kaf4qyTYwVTyO4 zcWZOXeSOiMQu1GR7aYPN72yomXRaGnEQV0lnlHPBPSOVq/N7KZxcxZW3xJIRh5Vnqs6 0SQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=i4aqPDxF; 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 h18si11716736ejk.355.2021.03.22.11.03.22; Mon, 22 Mar 2021 11:03:46 -0700 (PDT) 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=i4aqPDxF; 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 S230286AbhCVSB3 (ORCPT + 99 others); Mon, 22 Mar 2021 14:01:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:37561 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229804AbhCVSA6 (ORCPT ); Mon, 22 Mar 2021 14:00:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616436058; 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=20BQI+v76FGYKrR9SYXiHB1x/TtE4NUd6bjBJmSu1sw=; b=i4aqPDxFVfGdc5tAlyyKiRd8uYvLSNvq/S6ftRmJrVN9dj+kotJ35Q4pzg5phJ1okb15kb sxLEBBz4GQ45FzkFt21ttzfTc9Eltfa0ipWbKEfKoL0uu1CxsYy05LZpZLqBBljcr/oU5n xEPX6Vrmp03qlhncAhuML4YKrg6aKrw= 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-558-rzJ6FkYRMQi6SHbp6P78Ug-1; Mon, 22 Mar 2021 14:00:54 -0400 X-MC-Unique: rzJ6FkYRMQi6SHbp6P78Ug-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 282161922022; Mon, 22 Mar 2021 18:00:53 +0000 (UTC) Received: from madcap2.tricolour.ca (unknown [10.10.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D88FF19C9B; Mon, 22 Mar 2021 18:00:45 +0000 (UTC) Date: Mon, 22 Mar 2021 14:00:43 -0400 From: Richard Guy Briggs To: Arnd Bergmann Cc: Paul Moore , Eric Paris , Arnd Bergmann , Jules Irenge , linux-audit@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] [v2] audit: avoid -Wempty-body warning Message-ID: <20210322180043.GP3141668@madcap2.tricolour.ca> References: <20210322162807.679370-1-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210322162807.679370-1-arnd@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-03-22 17:27, Arnd Bergmann wrote: > From: Arnd Bergmann > > gcc warns about an empty statement when audit_remove_mark is defined to > nothing: > > kernel/auditfilter.c: In function 'audit_data_to_entry': > kernel/auditfilter.c:609:51: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body] > 609 | audit_remove_mark(entry->rule.exe); /* that's the template one */ > | ^ > > Change the macros to use the usual "do { } while (0)" instead, and change a > few more that were (void)0, for consistency. > > Signed-off-by: Arnd Bergmann Acked-by: Richard Guy Briggs > --- > v2: convert two more macros > --- > kernel/audit.h | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/kernel/audit.h b/kernel/audit.h > index 3b9c0945225a..1522e100fd17 100644 > --- a/kernel/audit.h > +++ b/kernel/audit.h > @@ -292,8 +292,8 @@ extern void audit_filter_inodes(struct task_struct *tsk, > extern struct list_head *audit_killed_trees(void); > #else /* CONFIG_AUDITSYSCALL */ > #define auditsc_get_stamp(c, t, s) 0 > -#define audit_put_watch(w) {} > -#define audit_get_watch(w) {} > +#define audit_put_watch(w) do { } while (0) > +#define audit_get_watch(w) do { } while (0) > #define audit_to_watch(k, p, l, o) (-EINVAL) > #define audit_add_watch(k, l) (-EINVAL) > #define audit_remove_watch_rule(k) BUG() > @@ -302,8 +302,8 @@ extern struct list_head *audit_killed_trees(void); > > #define audit_alloc_mark(k, p, l) (ERR_PTR(-EINVAL)) > #define audit_mark_path(m) "" > -#define audit_remove_mark(m) > -#define audit_remove_mark_rule(k) > +#define audit_remove_mark(m) do { } while (0) > +#define audit_remove_mark_rule(k) do { } while (0) > #define audit_mark_compare(m, i, d) 0 > #define audit_exe_compare(t, m) (-EINVAL) > #define audit_dupe_exe(n, o) (-EINVAL) > @@ -311,8 +311,8 @@ extern struct list_head *audit_killed_trees(void); > #define audit_remove_tree_rule(rule) BUG() > #define audit_add_tree_rule(rule) -EINVAL > #define audit_make_tree(rule, str, op) -EINVAL > -#define audit_trim_trees() (void)0 > -#define audit_put_tree(tree) (void)0 > +#define audit_trim_trees() do { } while (0) > +#define audit_put_tree(tree) do { } while (0) > #define audit_tag_tree(old, new) -EINVAL > #define audit_tree_path(rule) "" /* never called */ > #define audit_kill_trees(context) BUG() > -- > 2.29.2 > - 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