[PATCH] remove magic +1 from shm segment count

From: Manfred Spraul
Date: Sun Aug 08 2004 - 14:18:02 EST


Hi,

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.

Andrew - could you add the patch to your tree?

Signed-off-by: Manfred Spraul <manfred@xxxxxxxxxxxxxxxx> --- 2.6/ipc/shm.c 2004-08-07 11:14:24.000000000 +0200
+++ build-2.6/ipc/shm.c 2004-08-08 21:10:02.156421648 +0200
@@ -78,7 +78,7 @@

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);
}