Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f66d45e9 authored by Guy Streeter's avatar Guy Streeter Committed by Linus Torvalds
Browse files

[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: default avatarGuy Streeter <guy.streeter+lkml@gmail.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
--
parent 821836e5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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));