Commit fefd81e1 authored by Manfred Spraul's avatar Manfred Spraul Committed by Linus Torvalds

[PATCH] remove magic +1 from shm segment count

Michael Kerrisk found a bug in the shm accounting code: sysv shm allows to
create SHMMNI+1 shared memory segments, instead of SHMMNI segments.  The +1
is probably from the first shared anonymous mapping implementation that
used the sysv code to implement shared anon mappings.

The implementation got replaced, it's now the other way around (sysv uses
the shared anon code), but the +1 remained.
Signed-off-by: default avatarManfred Spraul <manfred@colorfullife.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 11c61286
...@@ -78,7 +78,7 @@ static inline struct shmid_kernel *shm_rmid(int id) ...@@ -78,7 +78,7 @@ static inline struct shmid_kernel *shm_rmid(int id)
static inline int shm_addid(struct shmid_kernel *shp) static inline int shm_addid(struct shmid_kernel *shp)
{ {
return ipc_addid(&shm_ids, &shp->shm_perm, shm_ctlmni+1); return ipc_addid(&shm_ids, &shp->shm_perm, shm_ctlmni);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment