Linux Test Project
 help / color / mirror / Atom feed
From: Li Wang <li.wang@linux.dev>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: wakel@google.com, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v7 1/4] lib: add module is loaded check
Date: Mon, 9 Nov 2026 11:25:58 +0800	[thread overview]
Message-ID: <avE9RuU4bEklMGkX@linux.dev> (raw)
In-Reply-To: <au3LKGR79fSjxMzq@yuki.lan>

> Hi!
> > +		if (i == mod_len) {
> 
> Shouldn't we check that next character is a whitespace here?
> 
> I guess that module name that is prefix of unrelated module is going to
> be rare but it's not impossible.

The length check above already guarantees this: p is advanced to the
first whitespace, so (p - line) is the length of the whole module name
field. If mod_name were a prefix of an unrelated module, the lengths
would differ and we continue before the character comparison. By the
time i == mod_len, line[mod_len] is exactly the field boundary.

    if ((size_t)(p - line) != mod_len)
        continue;


-- 
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2026-11-09  3:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03  7:57 [LTP] [PATCH v7 0/4] tst_kconfig: automatic module load/unload for CONFIG_*=m Li Wang (Hieco)
2026-11-03  7:57 ` [LTP] [PATCH v7 1/4] lib: add module is loaded check Li Wang (Hieco)
2026-11-03 10:19   ` [LTP] " linuxtestproject.agent
2026-11-06 12:42   ` [LTP] [PATCH v7 1/4] " Cyril Hrubis
2026-11-09  3:25     ` Li Wang [this message]
2026-11-11 16:13       ` Cyril Hrubis
2026-11-03  7:57 ` [LTP] [PATCH v7 2/4] tst_kconfig: load and unload kernel modules for CONFIG_*=m Li Wang (Hieco)
2026-11-06 12:50   ` Cyril Hrubis
2026-11-09  3:36     ` Li Wang
2026-11-03  7:57 ` [LTP] [PATCH v7 3/4] tst_kconfig: add module mappings for vsock/vsock_loopback Li Wang (Hieco)
2026-11-03  7:57 ` [LTP] [PATCH v7 4/4] testcases: drop manual tst_modprobe() now handled by tst_kconfig Li Wang (Hieco)

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=avE9RuU4bEklMGkX@linux.dev \
    --to=li.wang@linux.dev \
    --cc=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=wakel@google.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