[PATCH] acpi: s4: fix infinite loop because wrong variable being incremented

Colin Ian King colin.king at canonical.com
Tue Dec 2 16:03:45 UTC 2014


On 02/12/14 15:02, Keng-Yu Lin wrote:
> On Tue, Dec 2, 2014 at 6:17 PM, Colin King <colin.king at canonical.com> wrote:
>> From: Colin Ian King <colin.king at canonical.com>
>>
>> Fix typo on variable being incremented which leads to a possible
>> infinite loop while waiting. Detected by Coverity Scan.
>>
>> Signed-off-by: Colin Ian King <colin.king at canonical.com>
>> ---
>>  src/acpi/s4/s4.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/acpi/s4/s4.c b/src/acpi/s4/s4.c
>> index 684cb68..90a6bfd 100644
>> --- a/src/acpi/s4/s4.c
>> +++ b/src/acpi/s4/s4.c
>> @@ -425,7 +425,7 @@ static int s4_test_multiple(fwts_framework *fw)
>>                         tv.tv_usec = (awake_delay % 1000)*1000;
>>                         select(0, NULL, NULL, NULL, &tv);
>>
>> -                       for (j = 0; j < awake_delay / 1000; i++) {
>> +                       for (j = 0; j < awake_delay / 1000; j++) {
>>                                 snprintf(buffer, sizeof(buffer), "(Waiting %d/%d seconds)",
>>                                         j + 1, awake_delay / 1000);
>>                                 fwts_progress_message(fw, percent, buffer);
>> --
>> 2.1.3
>>
>>
> 
> oops, thanks to Coverity and Colin.

Well, thanks to coverity; I introduced this in commit
f22c45bf9a4aa4ca53f751a18645e79458bb35cd

> 
> Acked-by: Keng-Yu Lin <kengyu at canonical.com>
> 




More information about the fwts-devel mailing list