Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: compudj@krystal.dyndns.org (Mathieu Desnoyers)
Subject: [ltt-dev] Assertion failure
Date: Tue, 30 Nov 2010 15:25:04 -0500	[thread overview]
Message-ID: <20101130202504.GA28686@Krystal> (raw)
In-Reply-To: <0B313B6FF2091F4197B830CF774530F2015ADED0@na3-mail.mgc.mentorg.com>

* Klein, Russell (russell_klein at mentor.com) wrote:
> Mathieu,
> 
> Unfortunately not, this is the highest revision which is supported by
> the linux I am running.  I am willing to backport a fix if you can point
> me in the general direction.

See the following commit in the git tree:


commit 578e232ab4e234294d03fb7022863b45c801eaa1
Author: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
Date:   Tue Aug 17 18:23:21 2010 -0400

    UST strncpy assert fix
    
    fix off by one in strncpy and write asserts(). Shows only when the event
    reserved fits the exact end of buffer.
    
    Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>

diff --git a/libust/buffers.h b/libust/buffers.h
index 63449d6..9fedc48 100644
--- a/libust/buffers.h
+++ b/libust/buffers.h
@@ -522,7 +522,8 @@ static __inline__ int ust_buffers_write(struct ust_buffer *buf, size_t offset,
 	size_t buf_offset = BUFFER_OFFSET(offset, buf->chan);
 
 	assert(buf_offset < buf->chan->subbuf_size*buf->chan->subbuf_cnt);
-	assert(buf_offset + len < buf->chan->subbuf_size*buf->chan->subbuf_cnt);
+	assert(buf_offset + len
+	       <= buf->chan->subbuf_size*buf->chan->subbuf_cnt);
 
 	ust_buffers_do_copy(buf->buf_data + buf_offset, src, len);
 
@@ -590,7 +591,8 @@ int ust_buffers_strncpy(struct ust_buffer *buf, size_t offset, const void *src,
 	int terminated;
 
 	assert(buf_offset < buf->chan->subbuf_size*buf->chan->subbuf_cnt);
-	assert(buf_offset + len < buf->chan->subbuf_size*buf->chan->subbuf_cnt);
+	assert(buf_offset + len
+	       <= buf->chan->subbuf_size*buf->chan->subbuf_cnt);
 
 	copied = ust_buffers_do_strncpy(buf->buf_data + buf_offset,
 				        src, len, &terminated);

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com




      reply	other threads:[~2010-11-30 20:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-30 19:15 Klein, Russell
2010-11-30 19:15 ` Klein, Russell
2010-11-30 19:15 ` Klein, Russell
2010-11-30 19:30 ` Mathieu Desnoyers
2010-11-30 19:33   ` Klein, Russell
2010-11-30 20:25     ` Mathieu Desnoyers [this message]

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=20101130202504.GA28686@Krystal \
    --to=compudj@krystal.dyndns.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