lib/igt_kmod: Compare module names with strcmp
PATCH 1/1 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 paremter. For instance, if the "snd" module is loaded, igt_kmod_is_load("snd_hda_intel") will return true even if that module isn't loaded, thus causing drv_module_reload to failure in that scenario.
--- lib/igt_kmod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/igt_kmod.c +1 -1
@@ -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 ;
Signature · 6 lines
2.9.3 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 6 lines · Ander Conselvan de Oliveira
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 paremter. For instance, if the "snd" module is loaded,igt_kmod_is_load("snd_hda_intel")will return true even if that module isn't loaded, thus causingdrv_module_reloadto failure in that scenario.
Ah, that would explain some of the mystery.
Quoted 1 line
Signed-off-by Ander Conselvan de Oliveira <[email protected]>
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 8 lines · Chris Wilson
Quoted 6 lines · Ander Conselvan de Oliveira
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 paremter. For instance, if the "snd" module is loaded,igt_kmod_is_load("snd_hda_intel")will return true even if that module isn't loaded, thus causingdrv_module_reloadto failure in that scenario.
Quoted 6 lines
Ah, that would explain some of the mystery.
Quoted 2 lines
l.com>
Reviewed-by Chris Wilson <[email protected]>
Thanks. Pushed with commit message typos fixed.
Ander
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx