[igt-dev] [PATCH i-g-t] lib/igt_kmod: Fix uninitialized variable during module unload

Cavitt, Jonathan jonathan.cavitt at intel.com
Fri Nov 17 14:51:20 UTC 2023


-----Original Message-----
From: Roper, Matthew D <matthew.d.roper at intel.com> 
Sent: Thursday, November 16, 2023 4:17 PM
To: igt-dev at lists.freedesktop.org
Cc: Roper, Matthew D <matthew.d.roper at intel.com>; Cavitt, Jonathan <jonathan.cavitt at intel.com>
Subject: [PATCH i-g-t] lib/igt_kmod: Fix uninitialized variable during module unload
> 
> When unloading a module with no holders, the 'err' variable is checked
> without ever being initialized.
> 
> Noticed due to sporadic failures in
> igt at xe_module_load@reload-no-display, although other tests may also have
> been impacted.
> 
> Fixes: 5d4730e7f ("lib/igt_kmod: Allow some leeway in igt_kmod_unload_r")
> Cc: Jonathan Cavitt <jonathan.cavitt at intel.com>
> Signed-off-by: Matt Roper <matthew.d.roper at intel.com>

Acked-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
- Jonathan Cavitt

> ---
>  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 e967c9bcd..250ab2107 100644
> --- a/lib/igt_kmod.c
> +++ b/lib/igt_kmod.c
> @@ -263,7 +263,7 @@ static int igt_kmod_unload_r(struct kmod_module *kmod, unsigned int flags)
>  #define MAX_TRIES	20
>  #define SLEEP_DURATION	500000
>  	struct kmod_list *holders, *pos;
> -	int err, tries;
> +	int err = 0, tries;
>  	const char *mod_name = kmod_module_get_name(kmod);
>  
>  	if (kmod_module_get_initstate(kmod) == KMOD_MODULE_BUILTIN)
> -- 
> 2.41.0
> 
> 


More information about the igt-dev mailing list