[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250502131053.GB4198@noisy.programming.kicks-ass.net>
Date: Fri, 2 May 2025 15:10:53 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: mcgrof@...nel.org, x86@...nel.org, hpa@...or.com, petr.pavlu@...e.com,
samitolvanen@...gle.com, da.gomez@...sung.com, nathan@...nel.org,
nicolas@...sle.eu, linux-kernel@...r.kernel.org,
linux-modules@...r.kernel.org, linux-kbuild@...r.kernel.org,
hch@...radead.org, gregkh@...uxfoundation.org
Subject: Re: [PATCH -v2 5/7] module: Extend the MODULE_ namespace parsing
On Fri, Feb 07, 2025 at 05:41:54PM +0900, Masahiro Yamada wrote:
> > +static bool verify_module_namespace(const char *namespace, const char *modname)
> > +{
> > + size_t len, modlen = strlen(modname);
> > + const char *sep;
> > + bool glob;
> > +
> > + if (strncmp(namespace, "MODULE_", 7) != 0)
> > + return false;
> > +
> > + for (namespace += 7; *namespace; namespace = sep) {
> > + sep = strchrnul(namespace, ',');
> > + len = sep - namespace;
> > +
> > + glob = false;
> > + if (sep[-1] == '*') {
> > + len--;
> > + glob = true;
> > + }
>
>
> Why only limited to the trailing wildcard?
Because its simple and easy.
> Did you consider using glob_match()?
I had not, because I didn't know we had that in-kernel. Looking at that,
using it is a bit of a pain, since it needs the pattern as a C string,
which means I need to strdup() the thing because I can't modify the
original.
That in turn means we need to deal with malloc failure.
Is that all worth it?
Powered by blists - more mailing lists