diff options
author | Nicolas Dichtel <nicolas.dichtel@6wind.com> | 2015-04-13 09:20:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-04-13 13:09:44 -0400 |
commit | cf890138087a6da2f56a642acb80476370b04332 (patch) | |
tree | d8edd1bef49ffb77183a55122e67ab5a8efcd05f /security | |
parent | e60a9de49c3744aa44128eaaed3aca965911ca2e (diff) |
selinux/nlmsg: add a build time check for rtnl/xfrm cmds
When a new rtnl or xfrm command is added, this part of the code is frequently
missing. Let's help the developer with a build time test.
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'security')
-rw-r--r-- | security/selinux/nlmsgtab.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/security/selinux/nlmsgtab.c b/security/selinux/nlmsgtab.c index 30594bfa5fb1..2bbb41822d8e 100644 --- a/security/selinux/nlmsgtab.c +++ b/security/selinux/nlmsgtab.c | |||
@@ -153,6 +153,8 @@ int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm) | |||
153 | 153 | ||
154 | switch (sclass) { | 154 | switch (sclass) { |
155 | case SECCLASS_NETLINK_ROUTE_SOCKET: | 155 | case SECCLASS_NETLINK_ROUTE_SOCKET: |
156 | /* RTM_MAX always point to RTM_SETxxxx, ie RTM_NEWxxx + 3 */ | ||
157 | BUILD_BUG_ON(RTM_MAX != (RTM_NEWNSID + 3)); | ||
156 | err = nlmsg_perm(nlmsg_type, perm, nlmsg_route_perms, | 158 | err = nlmsg_perm(nlmsg_type, perm, nlmsg_route_perms, |
157 | sizeof(nlmsg_route_perms)); | 159 | sizeof(nlmsg_route_perms)); |
158 | break; | 160 | break; |
@@ -163,6 +165,7 @@ int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm) | |||
163 | break; | 165 | break; |
164 | 166 | ||
165 | case SECCLASS_NETLINK_XFRM_SOCKET: | 167 | case SECCLASS_NETLINK_XFRM_SOCKET: |
168 | BUILD_BUG_ON(XFRM_MSG_MAX != XFRM_MSG_MAPPING); | ||
166 | err = nlmsg_perm(nlmsg_type, perm, nlmsg_xfrm_perms, | 169 | err = nlmsg_perm(nlmsg_type, perm, nlmsg_xfrm_perms, |
167 | sizeof(nlmsg_xfrm_perms)); | 170 | sizeof(nlmsg_xfrm_perms)); |
168 | break; | 171 | break; |