[LTP] [PATCH v3 1/2] lib: Fix kernel module detection on BusyBox
Cyril Hrubis
chrubis@suse.cz
Wed Jan 20 16:28:11 CET 2021
Hi!
> modules.dep has format:
> module:[dependency [another-dependency ...]]
>
> e.g.:
> kernel/arch/x86/kernel/cpu/mce/mce-inject.ko.xz:
> kernel/arch/x86/crypto/twofish-x86_64.ko.xz: kernel/crypto/twofish_common.ko.xz
> kernel/arch/x86/crypto/aesni-intel.ko.xz: kernel/crypto/crypto_simd.ko.xz kernel/crypto/cryptd.ko.xz kernel/arch/x86/crypto/glue_helper.ko.xz
>
> First reading "%s" reads only first module with ':' separator.
> Searching without it could find first module which is as dependency (e.g.
> "/twofish_common.ko.xz" instead of "/twofish-x86_64.ko.xz"). Although that
> shouldn't be a problem, because it's very unlikely that module dependency is
> missing. Do you want me to drop sscanf() or put some comment?
Well it would be probably cleaner to do something as:
/* Cut dependencies after : */
if ((sep = strchr(buf, ':')))
*sep = 0;
No need to copy the string just because we neet to cut part of it.
> Also man modules.dep(5) warns about using text format as "their format is
> subject to change in the future". Hopefully we can depend on it. Or should we
> use binary format?
That depends on how complicated is to parse the binary format...
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list