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

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Nov 17 12:35:21 UTC 2023


Hi Matt,
On 2023-11-16 at 16:17:04 -0800, Matt Roper wrote:
> 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>

Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.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 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