[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240828221918.GF2130480@google.com>
Date: Wed, 28 Aug 2024 22:19:18 +0000
From: Sami Tolvanen <samitolvanen@...gle.com>
To: Petr Pavlu <petr.pavlu@...e.com>
Cc: Masahiro Yamada <masahiroy@...nel.org>,
Luis Chamberlain <mcgrof@...nel.org>,
Miguel Ojeda <ojeda@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Matthew Maurer <mmaurer@...gle.com>,
Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>,
Gary Guo <gary@...yguo.net>, Neal Gompa <neal@...pa.dev>,
Hector Martin <marcan@...can.st>, Janne Grunau <j@...nau.net>,
Asahi Linux <asahi@...ts.linux.dev>, linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-modules@...r.kernel.org,
rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v2 05/19] gendwarfksyms: Expand base_type
On Wed, Aug 28, 2024 at 02:46:03PM +0200, Petr Pavlu wrote:
> > +static int process_fmt(struct state *state, const char *fmt, ...)
>
> Nit: The state parameter is unused by a number of these process_*()
> functions, including the leaf process(). I suggest removing it so it
> doesn't need to be passed around unnecessarily.
Good point, I'll clean this up.
> > + char buf[MAX_FMT_BUFFER_SIZE];
> > + va_list args;
> > + int res;
> > +
> > + va_start(args, fmt);
> > +
> > + res = checkp(vsnprintf(buf, sizeof(buf), fmt, args));
> > + if (res >= MAX_FMT_BUFFER_SIZE - 1) {
>
> This check looks off by one, though on the safe side:
> res >= sizeof(buf)
True, I'll fix this too.
> > + if (dwarf_tag(&scopes[i]) == DW_TAG_compile_unit)
> > + continue;
> > +
> > + name = get_name(&scopes[i]);
> > + name = name ?: "<unnamed>";
> > + check(process(state, name));
> > + if (i > 0)
> > + check(process(state, "::"));
>
> Failed check(process()) calls here return immediately and so would leak
> scopes. However, I see this is fixed in the following patch
> "gendwarfksyms: Add a cache for processed DIEs" so it's ok.
Yeah, I noticed this as well. I think Masahiro's suggestion to just
exit immediately on errors cleans up this situation a bit.
Sami
Powered by blists - more mailing lists