linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selinux: constify nf_hook_ops
@ 2017-08-26 10:47 Arvind Yadav
  2017-08-28 21:34 ` Paul Moore
  0 siblings, 1 reply; 2+ messages in thread
From: Arvind Yadav @ 2017-08-26 10:47 UTC (permalink / raw)
  To: selinux, serge, james.l.morris, eparis, sds, paul
  Cc: linux-kernel, linux-security-module

nf_hook_ops are not supposed to change at runtime. nf_register_net_hooks
and nf_unregister_net_hooks are working with const nf_hook_ops.
So mark the non-const nf_hook_ops structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 security/selinux/hooks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 33fd061..2f2e133 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -6530,7 +6530,7 @@ security_initcall(selinux_init);
 
 #if defined(CONFIG_NETFILTER)
 
-static struct nf_hook_ops selinux_nf_ops[] = {
+static const struct nf_hook_ops selinux_nf_ops[] = {
 	{
 		.hook =		selinux_ipv4_postroute,
 		.pf =		NFPROTO_IPV4,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] selinux: constify nf_hook_ops
  2017-08-26 10:47 [PATCH] selinux: constify nf_hook_ops Arvind Yadav
@ 2017-08-28 21:34 ` Paul Moore
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Moore @ 2017-08-28 21:34 UTC (permalink / raw)
  To: Arvind Yadav
  Cc: selinux, serge, James Morris, Eric Paris, Stephen Smalley,
	linux-kernel, linux-security-module

On Sat, Aug 26, 2017 at 6:47 AM, Arvind Yadav <arvind.yadav.cs@gmail.com> wrote:
> nf_hook_ops are not supposed to change at runtime. nf_register_net_hooks
> and nf_unregister_net_hooks are working with const nf_hook_ops.
> So mark the non-const nf_hook_ops structs as const.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
>  security/selinux/hooks.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Merged, thanks.

> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index 33fd061..2f2e133 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -6530,7 +6530,7 @@ security_initcall(selinux_init);
>
>  #if defined(CONFIG_NETFILTER)
>
> -static struct nf_hook_ops selinux_nf_ops[] = {
> +static const struct nf_hook_ops selinux_nf_ops[] = {
>         {
>                 .hook =         selinux_ipv4_postroute,
>                 .pf =           NFPROTO_IPV4,
> --
> 2.7.4

-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-28 21:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-26 10:47 [PATCH] selinux: constify nf_hook_ops Arvind Yadav
2017-08-28 21:34 ` Paul Moore

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).