提交 f66d45e9 编写于 作者: G Guy Streeter 提交者: Linus Torvalds

[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: NGuy Streeter <guy.streeter+lkml@gmail.com>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
--
上级 821836e5
......@@ -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));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册