* [PATCH net-next] selinux/nlmsg: add a build time check for rtnl/xfrm cmds
@ 2015-04-13 13:20 Nicolas Dichtel
2015-04-13 17:10 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Dichtel @ 2015-04-13 13:20 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-security-module, linux-kernel, Nicolas Dichtel
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>
---
security/selinux/nlmsgtab.c | 3 +++
1 file changed, 3 insertions(+)
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)
switch (sclass) {
case SECCLASS_NETLINK_ROUTE_SOCKET:
+ /* RTM_MAX always point to RTM_SETxxxx, ie RTM_NEWxxx + 3 */
+ BUILD_BUG_ON(RTM_MAX != (RTM_NEWNSID + 3));
err = nlmsg_perm(nlmsg_type, perm, nlmsg_route_perms,
sizeof(nlmsg_route_perms));
break;
@@ -163,6 +165,7 @@ int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm)
break;
case SECCLASS_NETLINK_XFRM_SOCKET:
+ BUILD_BUG_ON(XFRM_MSG_MAX != XFRM_MSG_MAPPING);
err = nlmsg_perm(nlmsg_type, perm, nlmsg_xfrm_perms,
sizeof(nlmsg_xfrm_perms));
break;
--
2.2.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] selinux/nlmsg: add a build time check for rtnl/xfrm cmds
2015-04-13 13:20 [PATCH net-next] selinux/nlmsg: add a build time check for rtnl/xfrm cmds Nicolas Dichtel
@ 2015-04-13 17:10 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-04-13 17:10 UTC (permalink / raw)
To: nicolas.dichtel; +Cc: netdev, linux-security-module, linux-kernel
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Mon, 13 Apr 2015 15:20:37 +0200
> 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>
Yeah, I like stuff like this.
Applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-13 17:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-13 13:20 [PATCH net-next] selinux/nlmsg: add a build time check for rtnl/xfrm cmds Nicolas Dichtel
2015-04-13 17:10 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).