[LTP] [PATCH 1/3] commands/keyctl01: Fix potential infinite loop

Cyril Hrubis chrubis@suse.cz
Fri Jul 7 14:55:46 CEST 2017


Hi!
> diff --git a/testcases/commands/keyctl/keyctl01.sh b/testcases/commands/keyctl/keyctl01.sh
> index 076a130..5a97499 100644
> --- a/testcases/commands/keyctl/keyctl01.sh
> +++ b/testcases/commands/keyctl/keyctl01.sh
> @@ -62,15 +62,17 @@ cleanup()
>  
>  do_test()
>  {
> +	local quota_excd=0
>  	local maxkeysz=$((ORIG_KEYSZ + 100))
>  
> -	while true
> +	while [ $maxkeysz -gt $ORIG_KEYSZ ]

This may still be incorrect if some keys has been deleted after we
executed the setup() function though. This is quite unlikely but still
may happen. What about we ended the loop once $maxkeysz < 0?

Otherwise it looks fine.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list