diff options
author | Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> | 2017-02-03 11:51:33 +0200 |
---|---|---|
committer | Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> | 2017-02-03 12:41:52 +0200 |
commit | 33ab71c31bd9383585284abfbd04e1d93669dcae (patch) | |
tree | 9bf2bc30e3a58453fc288cebdc1e0dcd7a838679 /lib | |
parent | ed86fd9bb5f9a7e9a1da617ec96d2a0bdbd52e55 (diff) |
lib/igt_kmod: Compare module names with strcmp
The function igt_kmod_is_loaded() returns the wrong value when there is
a module loaded whose name is a prefix of the name supplied as a
parameter. For instance, if the "snd" module is loaded,
igt_kmod_is_loaded("snd_hda_intel") will return true even if that module
isn't loaded, thus causing drv_module_reload to fail in that scenario.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/igt_kmod.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c index 657a0e55..5981700c 100644 --- a/lib/igt_kmod.c +++ b/lib/igt_kmod.c @@ -91,7 +91,7 @@ igt_kmod_is_loaded(const char *mod_name) struct kmod_module *kmod = kmod_module_get_module(mod); const char *kmod_name = kmod_module_get_name(kmod); - if (!strncmp(kmod_name, mod_name, strlen(kmod_name))) { + if (!strcmp(kmod_name, mod_name)) { kmod_module_unref(kmod); ret = true; break; |