public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] lib/igt_kmod: Compare module names with strcmp
@ 2017-02-03 10:09 Ander Conselvan de Oliveira
  2017-02-03 10:24 ` Chris Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Ander Conselvan de Oliveira @ 2017-02-03 10:09 UTC (permalink / raw)
  To: intel-gfx; +Cc: 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 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(-)

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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH i-g-t] lib/igt_kmod: Compare module names with strcmp
  2017-02-03 10:09 [PATCH i-g-t] lib/igt_kmod: Compare module names with strcmp Ander Conselvan de Oliveira
@ 2017-02-03 10:24 ` Chris Wilson
  2017-02-03 10:44   ` Ander Conselvan De Oliveira
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Wilson @ 2017-02-03 10:24 UTC (permalink / raw)
  To: Ander Conselvan de Oliveira; +Cc: intel-gfx

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

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH i-g-t] lib/igt_kmod: Compare module names with strcmp
  2017-02-03 10:24 ` Chris Wilson
@ 2017-02-03 10:44   ` Ander Conselvan De Oliveira
  0 siblings, 0 replies; 3+ messages in thread
From: Ander Conselvan De Oliveira @ 2017-02-03 10:44 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-03 10:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-03 10:09 [PATCH i-g-t] lib/igt_kmod: Compare module names with strcmp Ander Conselvan de Oliveira
2017-02-03 10:24 ` Chris Wilson
2017-02-03 10:44   ` Ander Conselvan De Oliveira

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox