Skip to contentSkip to conversation

selinux: avoid extra semicolon

PATCH Applied Christian Göttsche 2 participants 2 messages May 2, 2022 – May 3, 2022 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selinux: avoid extra semicolon

Wrap macro into do { } while (0) to avoid Clang emitting warnings about extra semicolons.
Similar to userspace commit
https://github.com/SELinuxProject/selinux/commit/9d85aa60d12e468e7fd510c2b5475b5299b71622

---
 security/selinux/ss/avtab.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
security/selinux/ss/avtab.c +2 -2
index cfdae20792e1..6178af5fedbe 100644
@@ -40,7 +40,7 @@ static inline int avtab_hash(const struct avtab_key *keyp, u32 mask)
 
 	u32 hash = 0;
 
-#define mix(input) { \
+#define mix(input) do { \
 	u32 v = input; \
 	v *= c1; \
 	v = (v << r1) | (v >> (32 - r1)); \
@@ -48,7 +48,7 @@ static inline int avtab_hash(const struct avtab_key *keyp, u32 mask)
 	hash ^= v; \
 	hash = (hash << r2) | (hash >> (32 - r2)); \
 	hash = hash * m + n; \
-}
+} while (0)
 
 	mix(keyp->target_class);
 	mix(keyp->target_type);
Signature · 1 line
2.36.0
maintainer Applied
#1 lore raw
Quoted 10 lines · Christian Göttsche

Wrap macro into do { } while (0) to avoid Clang emitting warnings about extra semicolons.
Similar to userspace commit
https://github.com/SELinuxProject/selinux/commit/9d85aa60d12e468e7fd510c2b5475b5299b71622

---
 security/selinux/ss/avtab.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Merged into selinux/next with some whitespace tweaks.

Signature · 1 line
paul-moore.com