aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/util.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/util.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/util.c')
-rw-r--r--ipc/util.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ipc/util.c b/ipc/util.c
index 2eb0d1eaa312..9b3fa38afe2c 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -317,7 +317,7 @@ int ipc_addid(struct ipc_ids *ids, struct kern_ipc_perm *new, int size)
317 * when the key is IPC_PRIVATE. 317 * when the key is IPC_PRIVATE.
318 */ 318 */
319static int ipcget_new(struct ipc_namespace *ns, struct ipc_ids *ids, 319static int ipcget_new(struct ipc_namespace *ns, struct ipc_ids *ids,
320 struct ipc_ops *ops, struct ipc_params *params) 320 const struct ipc_ops *ops, struct ipc_params *params)
321{ 321{
322 int err; 322 int err;
323 323
@@ -344,7 +344,7 @@ static int ipcget_new(struct ipc_namespace *ns, struct ipc_ids *ids,
344 */ 344 */
345static int ipc_check_perms(struct ipc_namespace *ns, 345static int ipc_check_perms(struct ipc_namespace *ns,
346 struct kern_ipc_perm *ipcp, 346 struct kern_ipc_perm *ipcp,
347 struct ipc_ops *ops, 347 const struct ipc_ops *ops,
348 struct ipc_params *params) 348 struct ipc_params *params)
349{ 349{
350 int err; 350 int err;
@@ -375,7 +375,7 @@ static int ipc_check_perms(struct ipc_namespace *ns,
375 * On success, the ipc id is returned. 375 * On success, the ipc id is returned.
376 */ 376 */
377static int ipcget_public(struct ipc_namespace *ns, struct ipc_ids *ids, 377static int ipcget_public(struct ipc_namespace *ns, struct ipc_ids *ids,
378 struct ipc_ops *ops, struct ipc_params *params) 378 const struct ipc_ops *ops, struct ipc_params *params)
379{ 379{
380 struct kern_ipc_perm *ipcp; 380 struct kern_ipc_perm *ipcp;
381 int flg = params->flg; 381 int flg = params->flg;
@@ -678,7 +678,7 @@ out:
678 * Common routine called by sys_msgget(), sys_semget() and sys_shmget(). 678 * Common routine called by sys_msgget(), sys_semget() and sys_shmget().
679 */ 679 */
680int ipcget(struct ipc_namespace *ns, struct ipc_ids *ids, 680int ipcget(struct ipc_namespace *ns, struct ipc_ids *ids,
681 struct ipc_ops *ops, struct ipc_params *params) 681 const struct ipc_ops *ops, struct ipc_params *params)
682{ 682{
683 if (params->key == IPC_PRIVATE) 683 if (params->key == IPC_PRIVATE)
684 return ipcget_new(ns, ids, ops, params); 684 return ipcget_new(ns, ids, ops, params);