linux-btrace.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jeffm@suse.com
To: linux-btrace@vger.kernel.org
Subject: [PATCH 1/2] blkparse: skip check_cpu_map with pipe input
Date: Thu, 21 Oct 2021 14:16:19 +0000	[thread overview]
Message-ID: <20211021141620.2878-2-jeffm@suse.com> (raw)

From: Jeff Mahoney <jeffm@suse.com>

When we're using pipe input, we don't track online CPUs and don't have a
cpu_map.  When we start to show entries, check_sequence will be invoked.
If the first entry isn't sequence 1 (perhaps it's been dropped?), we'll
proceed to check_cpu_map.  Since we haven't tracked online CPUs,
pdi->cpu_map_max will be 0 and we'll do a malloc(0).  Then we'll start
setting bits corresponding to CPU numbers in memory we don't own.  Since
there's nothing to check here, let's skip it on pipe input.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 blkparse.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/blkparse.c b/blkparse.c
index f88204a..498857c 100644
--- a/blkparse.c
+++ b/blkparse.c
@@ -2229,6 +2229,10 @@ static int check_cpu_map(struct per_dev_info *pdi)
 	unsigned int i;
 	int ret, cpu;
 
+	/* Pipe input doesn't do CPU online tracking. */
+	if (!pdi->cpu_map_max)
+		return 0;
+
 	/*
 	 * create a map of the cpus we have traces for
 	 */
-- 
2.33.1

                 reply	other threads:[~2021-10-21 14:16 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=20211021141620.2878-2-jeffm@suse.com \
    --to=jeffm@suse.com \
    --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).