From: Namhyung Kim <namhyung@kernel.org>
To: acme@kernel.org, Gu Bin <gubin@cmss.chinamobile.com>
Cc: peterz@infradead.org, mingo@redhat.com, mark.rutland@arm.com,
alexander.shishkin@linux.intel.com, jolsa@kernel.org,
irogers@google.com, adrian.hunter@intel.com,
james.clark@linaro.org, linux-perf-users@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf data: fix inverted strncmp() in has_kcore_dir()
Date: Mon, 09 Nov 2026 18:52:24 -0800 [thread overview]
Message-ID: <179427914497.13444.12881343888822705562.b4-ty@kernel.org> (raw)
In-Reply-To: <20261103171127.1628-1-gubin@cmss.chinamobile.com>
On Wed, 04 Nov 2026 01:11:26 +0800, Gu Bin wrote:
> has_kcore_dir() scans the perf.data output directory for a "kcore_dir"
> (or guest "kcore_dir__*") entry and reports the match in `result`:
>
> result = d ? strncmp(d->d_name, name, n) : false;
>
> strncmp() returns 0 on a match, which coerces to boolean false, so the
> assignment is inverted: `result` is set to true on a non-matching entry
> and false on a matching one. Consequently the loop stops at the first
> non-matching entry, causing the function to incorrectly report a
> kcore_dir for any non-empty directory even if none exists. Only an
> empty directory or a failed opendir() returns false correctly.
>
> [...]
Applied to perf-tools-next, thanks!
Best regards,
Namhyung
prev parent reply other threads:[~2026-11-10 2:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 17:11 Gu Bin
2026-11-10 2:52 ` Namhyung Kim [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=179427914497.13444.12881343888822705562.b4-ty@kernel.org \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=gubin@cmss.chinamobile.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.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
all inboxes | Powered by JetHome®