[PATCH i-g-t] lib/igt_kmod: Compare module names with strcmp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@xxxxxxxxx>
---
 lib/igt_kmod.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index 657a0e5..5981700 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;
-- 
2.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux