From: Adrian Hunter <adrian.hunter@intel.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>, linux-kernel@vger.kernel.org
Subject: [PATCH V2 1/6] perf script: Fix documented const'ness of perf_dlfilter_fns
Date: Wed, 11 Aug 2021 13:10:31 +0300 [thread overview]
Message-ID: <20210811101036.17986-2-adrian.hunter@intel.com> (raw)
In-Reply-To: <20210811101036.17986-1-adrian.hunter@intel.com>
perf_dlfilter_fns must not be const, because it is not. Declaring it
const can result in it being mapped read-only, causing a segfaullt when
it is written. Update documentation accordingly.
Fixes: 8defa7147d5572 ("perf script: Add API for filtering via dynamically loaded shared object")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/Documentation/perf-dlfilter.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/Documentation/perf-dlfilter.txt b/tools/perf/Documentation/perf-dlfilter.txt
index 02842cb4cf90..ece07509d1f7 100644
--- a/tools/perf/Documentation/perf-dlfilter.txt
+++ b/tools/perf/Documentation/perf-dlfilter.txt
@@ -32,7 +32,7 @@ The API for filtering consists of the following:
----
#include <perf/perf_dlfilter.h>
-const struct perf_dlfilter_fns perf_dlfilter_fns;
+struct perf_dlfilter_fns perf_dlfilter_fns;
int start(void **data, void *ctx);
int stop(void *data, void *ctx);
@@ -214,7 +214,7 @@ Filter out everything except branches from "foo" to "bar":
#include <perf/perf_dlfilter.h>
#include <string.h>
-const struct perf_dlfilter_fns perf_dlfilter_fns;
+struct perf_dlfilter_fns perf_dlfilter_fns;
int filter_event(void *data, const struct perf_dlfilter_sample *sample, void *ctx)
{
--
2.17.1
next prev parent reply other threads:[~2021-08-11 10:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-11 10:10 [PATCH V2 0/6] perf tools: Add dlfilter test Adrian Hunter
2021-08-11 10:10 ` Adrian Hunter [this message]
2021-08-11 10:10 ` [PATCH V2 2/6] perf script: Fix unnecessary machine_resolve() Adrian Hunter
2021-08-11 10:10 ` [PATCH V2 3/6] perf script: Fix --list-dlfilters documentation Adrian Hunter
2021-08-11 10:10 ` [PATCH V2 4/6] perf tools: Amend dlfilter documentation wrt library dependencies Adrian Hunter
2021-08-11 10:10 ` [PATCH V2 5/6] perf tools: Move perf_dlfilters.h in the source tree Adrian Hunter
2021-08-11 10:10 ` [PATCH V2 6/6] perf tools: Add dlfilter test Adrian Hunter
2021-08-11 12:38 ` [PATCH V2 0/6] " Arnaldo Carvalho de Melo
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=20210811101036.17986-2-adrian.hunter@intel.com \
--to=adrian.hunter@intel.com \
--cc=acme@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@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