Skip to content

Commit

Permalink
[PATCH] correct sys_shmget allocation check
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
--
  • Loading branch information
guystreeter authored and Linus Torvalds committed Jan 23, 2007
1 parent 821836e commit f66d45e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ipc/shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit f66d45e

Please sign in to comment.