]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
xsm/flask: fix MISRA C 2012 Rule 20.7 violations
authorXenia Ragiadakou <burzalodowa@gmail.com>
Tue, 6 Sep 2022 14:02:28 +0000 (16:02 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 6 Sep 2022 14:02:28 +0000 (16:02 +0200)
In macros SIDTAB_HASH(), INIT_SIDTAB_LOCK(), SIDTAB_LOCK() and SIDTAB_UNLOCK(),
add parentheses around the macro parameter to prevent against unintended
expansions.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
xen/xsm/flask/ss/sidtab.c

index 74babfac9cf281f2d3ad1a8343dc6dcb55e8b087..69fc3389b36b3c29e8ecdd0725f56869e2ef76fd 100644 (file)
 #include "security.h"
 #include "sidtab.h"
 
-#define SIDTAB_HASH(sid) (sid & SIDTAB_HASH_MASK)
+#define SIDTAB_HASH(sid) ((sid) & SIDTAB_HASH_MASK)
 
-#define INIT_SIDTAB_LOCK(s) spin_lock_init(&s->lock)
-#define SIDTAB_LOCK(s) spin_lock(&s->lock)
-#define SIDTAB_UNLOCK(s) spin_unlock(&s->lock)
+#define INIT_SIDTAB_LOCK(s) spin_lock_init(&(s)->lock)
+#define SIDTAB_LOCK(s) spin_lock(&(s)->lock)
+#define SIDTAB_UNLOCK(s) spin_unlock(&(s)->lock)
 
 int sidtab_init(struct sidtab *s)
 {