Skip to content

Commit d4ceb1d

Browse files
arndbpcmoore
authored andcommitted
audit: avoid -Wempty-body warning
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 <[email protected]> Acked-by: Richard Guy Briggs <[email protected]> Signed-off-by: Paul Moore <[email protected]>
1 parent 7c585c9 commit d4ceb1d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

kernel/audit.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ extern void audit_filter_inodes(struct task_struct *tsk,
292292
extern struct list_head *audit_killed_trees(void);
293293
#else /* CONFIG_AUDITSYSCALL */
294294
#define auditsc_get_stamp(c, t, s) 0
295-
#define audit_put_watch(w) {}
296-
#define audit_get_watch(w) {}
295+
#define audit_put_watch(w) do { } while (0)
296+
#define audit_get_watch(w) do { } while (0)
297297
#define audit_to_watch(k, p, l, o) (-EINVAL)
298298
#define audit_add_watch(k, l) (-EINVAL)
299299
#define audit_remove_watch_rule(k) BUG()
@@ -302,17 +302,17 @@ extern struct list_head *audit_killed_trees(void);
302302

303303
#define audit_alloc_mark(k, p, l) (ERR_PTR(-EINVAL))
304304
#define audit_mark_path(m) ""
305-
#define audit_remove_mark(m)
306-
#define audit_remove_mark_rule(k)
305+
#define audit_remove_mark(m) do { } while (0)
306+
#define audit_remove_mark_rule(k) do { } while (0)
307307
#define audit_mark_compare(m, i, d) 0
308308
#define audit_exe_compare(t, m) (-EINVAL)
309309
#define audit_dupe_exe(n, o) (-EINVAL)
310310

311311
#define audit_remove_tree_rule(rule) BUG()
312312
#define audit_add_tree_rule(rule) -EINVAL
313313
#define audit_make_tree(rule, str, op) -EINVAL
314-
#define audit_trim_trees() (void)0
315-
#define audit_put_tree(tree) (void)0
314+
#define audit_trim_trees() do { } while (0)
315+
#define audit_put_tree(tree) do { } while (0)
316316
#define audit_tag_tree(old, new) -EINVAL
317317
#define audit_tree_path(rule) "" /* never called */
318318
#define audit_kill_trees(context) BUG()

0 commit comments

Comments
 (0)