From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 1/2] lib: Fix kernel module detection on BusyBox
Date: Tue, 19 Jan 2021 14:39:31 +0100 [thread overview]
Message-ID: <YAbhE9eB1AEM1BEk@pevik> (raw)
In-Reply-To: <YAbfKSZhZ35peObS@yuki.lan>
Hi Cyril,
> > + char buf[PATH_MAX], module[PATH_MAX], search[PATH_MAX] = "/";
...
> > + strcat(search, driver);
> > + strcat(search, ".ko");
> Why not just snprintf() or SAFE_ASPRINTF() here as well?
+1
> > + f = SAFE_FOPEN(NULL, path, "r");
> > +
> > + while (fgets(buf, sizeof(buf), f)) {
> > + if (sscanf(buf, "%s", module) != 1)
> > + continue;
> > +
> > + if (strstr(module, search) != NULL) {
> And I'm not sure that this is safe either, what about the case that one
> module name is a substring of another.
> E.g. if we look for "foo.ko" and the file contains "this_is_not_foo.ko"
> it will still match here.
char search[PATH_MAX] = "/"; => we search for "/foo.ko"
But that will be more obvious when I use SAFE_ASPRINTF() for search.
> Also this seems to be rather distruptive change, so I guess it would be
> safer to apply after the release.
I'll send v3, but no problem to postpone it.
But I'll revert 305a78e4c ("tst_net.sh: Require veth for netns") with
explanation that it wait for this fix, ok?
Kind regards,
Petr
prev parent reply other threads:[~2021-01-19 13:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-18 16:13 [LTP] [PATCH v2 1/2] lib: Fix kernel module detection on BusyBox Petr Vorel
2021-01-19 7:41 ` Petr Vorel
2021-01-20 11:22 ` Joerg Vehlow
2021-01-20 12:11 ` Petr Vorel
2021-01-19 13:31 ` Cyril Hrubis
2021-01-19 13:39 ` Petr Vorel [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=YAbhE9eB1AEM1BEk@pevik \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
/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