mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Guy Streeter" <guy.streeter@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: torvalds@osdl.org
Subject: [PATCH] correct sys_shmget allocation check
Date: Tue, 23 Jan 2007 12:20:04 -0600	[thread overview]
Message-ID: <52dd17640701231020s2ce96f09kc134cdb4432b154f@mail.gmail.com> (raw)

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>

--

Index: linux-2.6/ipc/shm.c
===================================================================
--- linux-2.6.orig/ipc/shm.c
+++ linux-2.6/ipc/shm.c
@@ -279,7 +279,7 @@ static int newseg (struct ipc_namespace
       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));

                 reply	other threads:[~2007-01-23 18:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52dd17640701231020s2ce96f09kc134cdb4432b154f@mail.gmail.com \
    --to=guy.streeter@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®