From: Aaron Tomlin <atomlin@redhat.com>
To: Christoph Lameter <cl@gentwo.de>
Cc: Oleksandr Natalenko <oleksandr@natalenko.name>,
mcgrof@kernel.org, pmladek@suse.com, mbenes@suse.cz,
christophe.leroy@csgroup.eu, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org,
atomlin@atomlin.com, ghalat@redhat.com, neelx@redhat.com
Subject: Re: [PATCH v3 2/2] module: Introduce module unload taint tracking
Date: Fri, 22 Apr 2022 13:23:03 +0100 [thread overview]
Message-ID: <20220422122303.6lbcrknnbs6vsgr6@ava.usersys.com> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2204221009390.1397495@gentwo.de>
On Fri 2022-04-22 10:11 +0200, Christoph Lameter wrote:
> On Thu, 21 Apr 2022, Aaron Tomlin wrote:
>
> > > > + if (len == strlen(mod->name) && !memcmp(mod_taint->name, mod->name, len) &&
> > >
> > > Here, two strings are compared, so I'd expect to see `strncmp()` instead of `memcmp()`.
> >
> > Good point. There are other examples of this throughout
> > kernel/module/main.c; albeit, I will use strncmp() here.
>
> Comparing the length first may be an attempt to avoid the expensive
> memcmp. But here we need to first execute strlen() to obtain the string
> length. This is already accessing all characters so this
> check is wasteful and a straight str[n]cmp is better.
Hi Christoph,
Agreed - we can skip the extra strlen().
Thanks,
--
Aaron Tomlin
prev parent reply other threads:[~2022-04-22 12:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-20 11:52 [PATCH v3 0/2] module: Introduce module unload taint tracking Aaron Tomlin
2022-04-20 11:52 ` [PATCH v3 1/2] module: Make module_flags_taint() accept a module's taints bitmap directly Aaron Tomlin
2022-04-20 11:52 ` [PATCH v3 2/2] module: Introduce module unload taint tracking Aaron Tomlin
2022-04-21 6:43 ` kernel test robot
2022-04-21 14:28 ` Oleksandr Natalenko
2022-04-21 14:57 ` Aaron Tomlin
2022-04-22 8:11 ` Christoph Lameter
2022-04-22 12:23 ` Aaron Tomlin [this message]
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=20220422122303.6lbcrknnbs6vsgr6@ava.usersys.com \
--to=atomlin@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=atomlin@atomlin.com \
--cc=christophe.leroy@csgroup.eu \
--cc=cl@gentwo.de \
--cc=ghalat@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=mcgrof@kernel.org \
--cc=neelx@redhat.com \
--cc=oleksandr@natalenko.name \
--cc=pmladek@suse.com \
/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).