All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix build failures from audit macros when following coding style
@ 2012-02-27 19:41 John Johansen
  0 siblings, 0 replies; only message in thread
From: John Johansen @ 2012-02-27 19:41 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-security-module, eparis

Recently I was cleaning up some code and hit build failures when following
the kernel coding style / checkpatch.pl recommendations.  In both cases
the code had the form of

  if (X)
	Y;
  else
	Z;

where Y or Z were either the macros audit_log_string or COMMON_AUDIT_DATA_INIT

and the failure was
  error: 'else' without a previous 'if'

Signed-off-by: John Johansen <john.johansen@canonical.com>
---
 include/linux/audit.h     |    2 +-
 include/linux/lsm_audit.h |    8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/linux/audit.h b/include/linux/audit.h
index 9ff7a2c..583010f 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -676,7 +676,7 @@ extern void		    audit_log_n_hex(struct audit_buffer *ab,
 extern void		    audit_log_n_string(struct audit_buffer *ab,
 					       const char *buf,
 					       size_t n);
-#define audit_log_string(a,b) audit_log_n_string(a, b, strlen(b));
+#define audit_log_string(a,b) audit_log_n_string(a, b, strlen(b))
 extern void		    audit_log_n_untrustedstring(struct audit_buffer *ab,
 							const char *string,
 							size_t n);
diff --git a/include/linux/lsm_audit.h b/include/linux/lsm_audit.h
index 88e78de..7a0841c 100644
--- a/include/linux/lsm_audit.h
+++ b/include/linux/lsm_audit.h
@@ -143,9 +143,11 @@ int ipv6_skb_to_auditdata(struct sk_buff *skb,
 		struct common_audit_data *ad, u8 *proto);
 
 /* Initialize an LSM audit data structure. */
-#define COMMON_AUDIT_DATA_INIT(_d, _t) \
-	{ memset((_d), 0, sizeof(struct common_audit_data)); \
-	 (_d)->type = LSM_AUDIT_DATA_##_t; }
+#define COMMON_AUDIT_DATA_INIT(_d, _t)				\
+do {								\
+	memset((_d), 0, sizeof(struct common_audit_data));	\
+	(_d)->type = LSM_AUDIT_DATA_##_t;			\
+} while (0)
 
 void common_lsm_audit(struct common_audit_data *a);
 
-- 
1.7.9


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-02-27 19:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-27 19:41 [PATCH] Fix build failures from audit macros when following coding style John Johansen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.