diff options
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/util.c | 4 | ||||
-rw-r--r-- | ipc/util.h | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/ipc/util.c b/ipc/util.c index 9b0c4e7753af..c51c96f2e0cf 100644 --- a/ipc/util.c +++ b/ipc/util.c | |||
@@ -413,7 +413,7 @@ int ipcget_public(struct ipc_namespace *ns, struct ipc_ids *ids, | |||
413 | 413 | ||
414 | void ipc_rmid(struct ipc_ids *ids, struct kern_ipc_perm *ipcp) | 414 | void ipc_rmid(struct ipc_ids *ids, struct kern_ipc_perm *ipcp) |
415 | { | 415 | { |
416 | int lid = ipcp->id % SEQ_MULTIPLIER; | 416 | int lid = ipcid_to_idx(ipcp->id); |
417 | 417 | ||
418 | idr_remove(&ids->ipcs_idr, lid); | 418 | idr_remove(&ids->ipcs_idr, lid); |
419 | 419 | ||
@@ -672,7 +672,7 @@ void ipc64_perm_to_ipc_perm (struct ipc64_perm *in, struct ipc_perm *out) | |||
672 | struct kern_ipc_perm *ipc_lock(struct ipc_ids *ids, int id) | 672 | struct kern_ipc_perm *ipc_lock(struct ipc_ids *ids, int id) |
673 | { | 673 | { |
674 | struct kern_ipc_perm *out; | 674 | struct kern_ipc_perm *out; |
675 | int lid = id % SEQ_MULTIPLIER; | 675 | int lid = ipcid_to_idx(id); |
676 | 676 | ||
677 | rcu_read_lock(); | 677 | rcu_read_lock(); |
678 | out = idr_find(&ids->ipcs_idr, lid); | 678 | out = idr_find(&ids->ipcs_idr, lid); |
diff --git a/ipc/util.h b/ipc/util.h index 2a03d8cc6a01..fa7e7a07486e 100644 --- a/ipc/util.h +++ b/ipc/util.h | |||
@@ -79,6 +79,8 @@ void __init ipc_init_proc_interface(const char *path, const char *header, | |||
79 | #define IPC_MSG_IDS 1 | 79 | #define IPC_MSG_IDS 1 |
80 | #define IPC_SHM_IDS 2 | 80 | #define IPC_SHM_IDS 2 |
81 | 81 | ||
82 | #define ipcid_to_idx(id) ((id) % SEQ_MULTIPLIER) | ||
83 | |||
82 | /* must be called with ids->mutex acquired.*/ | 84 | /* must be called with ids->mutex acquired.*/ |
83 | int ipc_addid(struct ipc_ids *, struct kern_ipc_perm *, int); | 85 | int ipc_addid(struct ipc_ids *, struct kern_ipc_perm *, int); |
84 | int ipc_get_maxid(struct ipc_ids *); | 86 | int ipc_get_maxid(struct ipc_ids *); |