trinity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tommi Rantala <tt.rantala@gmail.com>
To: davej@codemonkey.org.uk
Cc: trinity@vger.kernel.org, Tommi Rantala <tt.rantala@gmail.com>
Subject: [PATCH] fix off-by-one in dump_childnos()
Date: Sun, 16 Apr 2017 21:29:14 +0300	[thread overview]
Message-ID: <20170416182914.24457-1-tt.rantala@gmail.com> (raw)

Fixes a segfault:

  ## pids: (60 active)
  0-7: 0 0 0 0 0 0 0 0
  8-15: 0 0 0 0 0 0 0 0
  16-23: 0 0 0 0 0 0 0 0
  24-31: 0 0 0 0 0 0 0 0
  32-39: 0 11081 11082 11083 11084 11085 11086 11087
  40-47: 11088 11089 11090 11091 11093 11094 11095 11096
  48-55: 11097 11098 11099 11100 11101 11102 0 0
  Segmentation fault
---
 pids.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pids.c b/pids.c
index 8b77e2f..1a23284 100644
--- a/pids.c
+++ b/pids.c
@@ -82,7 +82,7 @@ void dump_childnos(void)
 		for (j = 0; j < 8; j++) {
 			struct childdata *child;
 
-			if (i + j > max_children)
+			if (i + j >= max_children)
 				break;
 
 			child = shm->children[i + j];
-- 
2.9.3

             reply	other threads:[~2017-04-16 18:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-16 18:29 Tommi Rantala [this message]
2017-04-16 18:34 ` [PATCH] fix off-by-one in dump_childnos() Dave Jones
2017-04-16 19:35   ` Tommi Rantala

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=20170416182914.24457-1-tt.rantala@gmail.com \
    --to=tt.rantala@gmail.com \
    --cc=davej@codemonkey.org.uk \
    --cc=trinity@vger.kernel.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).