]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] correct sys_shmget allocation check
authorGuy Streeter <guy.streeter@gmail.com>
Tue, 23 Jan 2007 18:20:04 +0000 (12:20 -0600)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 23 Jan 2007 19:18:50 +0000 (11:18 -0800)
As written, sys_shmget will return ENOSPC when one page is still
available for allocation. This patch corrects the test.

Signed-off-by: Guy Streeter <guy.streeter+lkml@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
--

ipc/shm.c

index 6d16bb6de7d296889b015b8ab6c8d480d2c14aa4..f8e10a25ad7d9ece3f9e409eb3859ba282faed73 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -279,7 +279,7 @@ static int newseg (struct ipc_namespace *ns, key_t key, int shmflg, size_t size)
        if (size < SHMMIN || size > ns->shm_ctlmax)
                return -EINVAL;
 
-       if (ns->shm_tot + numpages >= ns->shm_ctlall)
+       if (ns->shm_tot + numpages > ns->shm_ctlall)
                return -ENOSPC;
 
        shp = ipc_rcu_alloc(sizeof(*shp));