summaryrefslogtreecommitdiffstats
path: root/security/selinux/ss/sidtab.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2022-01-25 15:14:14 +0100
committerPaul Moore <paul@paul-moore.com>2022-01-26 21:13:58 +0100
commit9e2fe574c02bde46307255467a5e4291f65227fe (patch)
tree5a94795947835f92fe02bbcf9a93ee369c0ddbfc /security/selinux/ss/sidtab.c
parentselinux: declare name parameter of hash_eval const (diff)
downloadlinux-9e2fe574c02bde46307255467a5e4291f65227fe.tar.xz
linux-9e2fe574c02bde46307255467a5e4291f65227fe.zip
selinux: enclose macro arguments in parenthesis
Enclose the macro arguments in parenthesis to avoid potential evaluation order issues. Note the xperm and ebitmap macros are still not side-effect safe due to double evaluation. Reported by clang-tidy [bugprone-macro-parentheses] Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/selinux/ss/sidtab.c')
-rw-r--r--security/selinux/ss/sidtab.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/security/selinux/ss/sidtab.c b/security/selinux/ss/sidtab.c
index 293ec048af08..a54b8652bfb5 100644
--- a/security/selinux/ss/sidtab.c
+++ b/security/selinux/ss/sidtab.c
@@ -27,8 +27,8 @@ struct sidtab_str_cache {
char str[];
};
-#define index_to_sid(index) (index + SECINITSID_NUM + 1)
-#define sid_to_index(sid) (sid - (SECINITSID_NUM + 1))
+#define index_to_sid(index) ((index) + SECINITSID_NUM + 1)
+#define sid_to_index(sid) ((sid) - (SECINITSID_NUM + 1))
int sidtab_init(struct sidtab *s)
{