Преглед изворни кода

[PATCH] correct sys_shmget allocation check

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>
--
Guy Streeter пре 18 година
родитељ
комит
f66d45e99e
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      ipc/shm.c

+ 1 - 1
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)
 	if (size < SHMMIN || size > ns->shm_ctlmax)
 		return -EINVAL;
 		return -EINVAL;
 
 
-	if (ns->shm_tot + numpages >= ns->shm_ctlall)
+	if (ns->shm_tot + numpages > ns->shm_ctlall)
 		return -ENOSPC;
 		return -ENOSPC;
 
 
 	shp = ipc_rcu_alloc(sizeof(*shp));
 	shp = ipc_rcu_alloc(sizeof(*shp));