ACK: [PATCH] acpi: mpst: fix potential infinite loop on 16 bit counter j

ivanhu ivan.hu at canonical.com
Tue Jul 7 01:58:20 UTC 2020



On 7/7/20 1:57 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
> 
> The 16 bit loop counter j is being compared to a 32 bit upper loop
> bound, there is a theoretical bug where the upper bound is more
> than 65535 and the will iterate forever.  Avoid this by making the
> loop counter a 32 bit integer.
> 
> Addresses-Coverity: ("Infinite loop")
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/acpi/mpst/mpst.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/acpi/mpst/mpst.c b/src/acpi/mpst/mpst.c
> index e9632414..4bfe3179 100644
> --- a/src/acpi/mpst/mpst.c
> +++ b/src/acpi/mpst/mpst.c
> @@ -47,7 +47,8 @@ static int mpst_test1(fwts_framework *fw)
>  	bool passed = true;
>  	uint32_t reserved;
>  	uint32_t node_offset;
> -	uint16_t i, j;
> +	uint32_t j;
> +	uint16_t i;
>  
>  	reserved = (uint32_t) mpst->reserved[0] +
>  		   ((uint32_t) mpst->reserved[1] << 8) +
> 


Acked-by: Ivan Hu <ivan.hu at canonical.com>



More information about the fwts-devel mailing list