linux-btrace.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Boyle <mlb@corefiling.co.uk>
To: linux-btrace@vger.kernel.org
Subject: [PATCH] blktrace:  pass a valid pointer to realloc.
Date: Mon, 20 Jun 2011 13:12:17 +0000	[thread overview]
Message-ID: <4DFF4731.6010001@corefiling.co.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 486 bytes --]

When blktrace is writing to stdout, and there's sufficient disk activity
to fill the trace buffer, tb_combine() tries to increase the buffer
size.  But the pointer it passes to realloc isn't to the head of the
block of memory.  glibc's realloc gets really quite upset at this, and
aborts the process.

This just passes in the pointer handed out by malloc.

Signed-off-by: Matt Boyle <mlb@corefiling.co.uk>
---
  blktrace.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)



[-- Attachment #2: 0001-blktrace-pass-a-valid-pointer-to-realloc.patch --]
[-- Type: text/x-patch, Size: 405 bytes --]

diff --git a/blktrace.c b/blktrace.c
index 72866e2..d4d5111 100644
--- a/blktrace.c
+++ b/blktrace.c
@@ -1330,7 +1330,7 @@ static struct trace_buf *tb_combine(struct trace_buf *prev,
 		 * the whole structures, as the other fields
 		 * are "static".
 		 */
-		prev = realloc(prev->buf, sizeof(*prev) + tot_len);
+		prev = realloc(prev, sizeof(*prev) + tot_len);
 		prev->buf = (void *)(prev + 1);
 	}
 


                 reply	other threads:[~2011-06-20 13:12 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=4DFF4731.6010001@corefiling.co.uk \
    --to=mlb@corefiling.co.uk \
    --cc=linux-btrace@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).