From: Steven Rostedt <rostedt@goodmis.org>
To: Steven Rostedt <rostedt@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
linux-kbuild@vger.kernel.org, llvm@lists.linux.dev,
Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
Arnd Bergmann <arnd@arndb.de>,
Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nicolas.schier@linux.dev>,
Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH v5 2/3] tracing: Add a tracepoint verification check at build time
Date: Fri, 25 Jul 2025 09:49:40 -0400 [thread overview]
Message-ID: <20250725094940.4d976695@gandalf.local.home> (raw)
In-Reply-To: <20250725025213.342188378@kernel.org>
On Thu, 24 Jul 2025 22:51:51 -0400
Steven Rostedt <rostedt@kernel.org> wrote:
> +#define for_each_shdr_str(len, ehdr, sec) \
> + for (const char *str = (void *)(ehdr) + shdr_offset(sec), \
> + *end = (str) + shdr_size(sec); \
> + len = strlen(str), (str) < end; \
> + str += (len) + 1, len = strlen(str))
The second "len = strlen(str)" can be removed as the len = strlen(str) in
the conditional will work for every iteration too.
To keep the "end" from being declared before the loop, I had to have both
str and end declared in the loop as "const char *", but that meant I
couldn't initialize "len" in the start portion of the for loop. I then
moved it to the conditional portion, but forgot to remove it from the
increment portion.
The above should look like:
for (const char *str = (void *)(ehdr) + shdr_offset(sec),
*end = str + shdr_size(sec);
len = strlen(str), str < end;
str += (len) + 1)
-- Steve
next prev parent reply other threads:[~2025-07-25 13:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-25 2:51 [PATCH v5 0/3] tracepoints: Add warnings for unused tracepoints and trace events Steven Rostedt
2025-07-25 2:51 ` [PATCH v5 1/3] sorttable: Move ELF parsing into scripts/elf-parse.[ch] Steven Rostedt
2025-07-25 2:51 ` [PATCH v5 2/3] tracing: Add a tracepoint verification check at build time Steven Rostedt
2025-07-25 13:15 ` Mathieu Desnoyers
2025-07-25 13:41 ` Steven Rostedt
2025-07-25 13:49 ` Steven Rostedt [this message]
2025-07-26 10:36 ` kernel test robot
2025-07-25 2:51 ` [PATCH v5 3/3] tracepoint: Do not warn for unused event that is exported Steven Rostedt
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=20250725094940.4d976695@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mark.rutland@arm.com \
--cc=masahiroy@kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=nicolas.schier@linux.dev \
--cc=rostedt@kernel.org \
--cc=torvalds@linux-foundation.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).