aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/sem.c
diff options
context:
space:
mode:
authorMathias Krause <minipli@googlemail.com>2014-06-06 17:37:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-06 19:08:14 -0400
commiteb66ec44f867834de054544b09b573de3a7ae456 (patch)
tree4fabad7ced4ce6145d44e8e25bd6ee111712e9f8 /ipc/sem.c
parent3e4e0f0a8756dade3023d1f47d50fbced7749788 (diff)
ipc: constify ipc_ops
There is no need to recreate the very same ipc_ops structure on every kernel entry for msgget/semget/shmget. Just declare it static and be done with it. While at it, constify it as we don't modify the structure at runtime. Found in the PaX patch, written by the PaX Team. Signed-off-by: Mathias Krause <minipli@googlemail.com> Cc: PaX Team <pageexec@freemail.hu> Cc: Davidlohr Bueso <davidlohr@hp.com> Cc: Manfred Spraul <manfred@colorfullife.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc/sem.c')
-rw-r--r--ipc/sem.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ipc/sem.c b/ipc/sem.c
index bee555417312..3fcbc96abee9 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -564,7 +564,11 @@ static inline int sem_more_checks(struct kern_ipc_perm *ipcp,
564SYSCALL_DEFINE3(semget, key_t, key, int, nsems, int, semflg) 564SYSCALL_DEFINE3(semget, key_t, key, int, nsems, int, semflg)
565{ 565{
566 struct ipc_namespace *ns; 566 struct ipc_namespace *ns;
567 struct ipc_ops sem_ops; 567 static const struct ipc_ops sem_ops = {
568 .getnew = newary,
569 .associate = sem_security,
570 .more_checks = sem_more_checks,
571 };
568 struct ipc_params sem_params; 572 struct ipc_params sem_params;
569 573
570 ns = current->nsproxy->ipc_ns; 574 ns = current->nsproxy->ipc_ns;
@@ -572,10 +576,6 @@ SYSCALL_DEFINE3(semget, key_t, key, int, nsems, int, semflg)
572 if (nsems < 0 || nsems > ns->sc_semmsl) 576 if (nsems < 0 || nsems > ns->sc_semmsl)
573 return -EINVAL; 577 return -EINVAL;
574 578
575 sem_ops.getnew = newary;
576 sem_ops.associate = sem_security;
577 sem_ops.more_checks = sem_more_checks;
578
579 sem_params.key = key; 579 sem_params.key = key;
580 sem_params.flg = semflg; 580 sem_params.flg = semflg;
581 sem_params.u.nsems = nsems; 581 sem_params.u.nsems = nsems;