[LTP] [PATCH v7 1/4] lib: add module is loaded check

Li Wang li.wang@linux.dev
Mon Nov 9 04:25:58 CET 2026


> 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


More information about the ltp mailing list