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

Guangwen Feng fenggw-fnst@cn.fujitsu.com
Tue Jul 11 13:48:33 CEST 2017


Hi!

Thanks for your review.

在 07/07/2017 08:55 PM, Cyril Hrubis 写道:
> 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?

Yes, it sounds more reasonable,
I got it, thanks.

Best Regards,
Guangwen Feng

> 
> Otherwise it looks fine.
> 




More information about the ltp mailing list