All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Cc: Vincent Donnefort <vdonnefort@google.com>,
	"Steven Rostedt (Google)" <rostedt@goodmis.org>
Subject: [PATCH 2/3] kbuffer: Add event if the buffer just fits in kbuffer_read_buffer()
Date: Fri,  5 Jan 2024 14:37:43 -0500	[thread overview]
Message-ID: <20240105194015.253165-3-rostedt@goodmis.org> (raw)
In-Reply-To: <20240105194015.253165-1-rostedt@goodmis.org>

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

If the buffer passed in is exactly the size needed to add an event, it will
not because it checks with:

  while (len > kbuf->next - save_curr) {

Instead of

  while (len >= kbuf->next - save_curr) {

Fixes: 05821189 ("kbuffer: Add kbuffer_read_buffer()")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 src/kbuffer-parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/kbuffer-parse.c b/src/kbuffer-parse.c
index d43fe5d972fd..4801d432c58c 100644
--- a/src/kbuffer-parse.c
+++ b/src/kbuffer-parse.c
@@ -995,7 +995,7 @@ int kbuffer_read_buffer(struct kbuffer *kbuf, void *buffer, int len)
 		/* Due to timestamps, we must save the current next to use */
 		last_next = kbuf->next;
 
-		while (len > kbuf->next - save_curr) {
+		while (len >= kbuf->next - save_curr) {
 			last_next = kbuf->next;
 			if (!kbuffer_next_event(kbuf, &ts))
 				break;
-- 
2.42.0


  parent reply	other threads:[~2024-01-05 19:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-05 19:37 [PATCH 0/3] kbuffer: Some minor fixes Steven Rostedt
2024-01-05 19:37 ` [PATCH 1/3] libtraceevent Documentation: Fix tep_kbuffer() prototype Steven Rostedt
2024-01-05 19:37 ` Steven Rostedt [this message]
2024-01-05 19:37 ` [PATCH 3/3] kbuffer: Update kbuf->next in kbuffer_refresh() Steven Rostedt
2024-01-05 21:01   ` Vincent Donnefort
2024-01-08 11:11     ` Vincent Donnefort
2024-01-08 16:28       ` Steven Rostedt
2024-01-08 16:47         ` Vincent Donnefort

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=20240105194015.253165-3-rostedt@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=vdonnefort@google.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.