Message ID | 20170203100946.8789-1-ander.conselvan.de.oliveira@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Feb 03, 2017 at 12:09:46PM +0200, Ander Conselvan de Oliveira wrote: > 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. Ah, that would explain some of the mystery. > Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> -Chris
On Fri, 2017-02-03 at 10:24 +0000, Chris Wilson wrote: > On Fri, Feb 03, 2017 at 12:09:46PM +0200, Ander Conselvan de Oliveira wrote: > > 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. > > Ah, that would explain some of the mystery. > > > Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@inte > > l.com> > > Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Thanks. Pushed with commit message typos fixed. Ander
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;
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@intel.com> --- lib/igt_kmod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)