[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250725094940.4d976695@gandalf.local.home>
Date: Fri, 25 Jul 2025 09:49:40 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Steven Rostedt <rostedt@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
linux-kbuild@...r.kernel.org, llvm@...ts.linux.dev, Masami Hiramatsu
<mhiramat@...nel.org>, Mark Rutland <mark.rutland@....com>, Mathieu
Desnoyers <mathieu.desnoyers@...icios.com>, Andrew Morton
<akpm@...ux-foundation.org>, Arnd Bergmann <arnd@...db.de>, Masahiro Yamada
<masahiroy@...nel.org>, Nathan Chancellor <nathan@...nel.org>, Nicolas
Schier <nicolas.schier@...ux.dev>, Nick Desaulniers
<nick.desaulniers+lkml@...il.com>, Catalin Marinas
<catalin.marinas@....com>, Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH v5 2/3] tracing: Add a tracepoint verification check at
build time
On Thu, 24 Jul 2025 22:51:51 -0400
Steven Rostedt <rostedt@...nel.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
Powered by blists - more mailing lists