From: Ian Wienand <ian@wienand.org>
To: linux-numa@vger.kernel.org
Cc: 712692@bugs.debian.org
Subject: [PATCH] Fix segfault in read_distance_table when no NUMA
Date: Wed, 19 Jun 2013 21:56:08 +1000 [thread overview]
Message-ID: <20130619115608.GA30133@gmail.com> (raw)
Hi
Debian bug #712692 reported a segfault on systems with no numa info.
In this case, read_distance_table would exit with "0" which was not
picked up as an error by numa_distance(), leading to a dereference of
distance_table.
Signed-off-by: Ian Wienand <ian@wienand.org>
---
distance.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/distance.c b/distance.c
index 4a26972..ec423c4 100755
--- a/distance.c
+++ b/distance.c
@@ -58,15 +58,13 @@ static int read_distance_table(void)
int *table = NULL;
int err = -1;
- for (nd = 0;; nd++) {
+ for (nd = 0; nd<maxnode; nd++) {
char fn[100];
FILE *dfh;
sprintf(fn, "/sys/devices/system/node/node%d/distance", nd);
dfh = fopen(fn, "r");
if (!dfh) {
if (errno == ENOENT)
- err = 0;
- if (!err && nd<maxnode)
continue;
else
break;
--
1.7.10.4
reply other threads:[~2013-06-19 11:56 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=20130619115608.GA30133@gmail.com \
--to=ian@wienand.org \
--cc=712692@bugs.debian.org \
--cc=linux-numa@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 NNTP newsgroup(s).