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

Andrea Cervesato andrea.cervesato@suse.com
Mon Oct 12 17:48:14 CEST 2026


Hi Li,

> +
> +bool tst_module_is_loaded(const char *mod_name)
> +{
> +	char line[4096];
> +	size_t mod_len = strlen(mod_name);
> +	FILE *file;
> +
> +	file = fopen("/proc/modules", "r");
> +	if (!file)
> +		return false;

why not using SAFE_FILE_LINES_SCANF() ?

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com


More information about the ltp mailing list