LGTM
Reviewed-by:Sid Manning [email protected]

On Sat, Sep 5, 2026 at 1:10 PM Brian Cain <[email protected]>
wrote:

> Cast to uint32_t before multiplying uint16_t values to prevent
> signed integer overflow. Without the cast, the uint16_t operands
> are promoted to int, and the product can overflow the int range.
> Found with UBSan.
>
> Signed-off-by: Brian Cain <[email protected]>
> ---
>  tests/tcg/hexagon/v69_hvx.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tests/tcg/hexagon/v69_hvx.c b/tests/tcg/hexagon/v69_hvx.c
> index a0d567d142f..eff936064a0 100644
> --- a/tests/tcg/hexagon/v69_hvx.c
> +++ b/tests/tcg/hexagon/v69_hvx.c
> @@ -292,7 +292,8 @@ static void test_vmpyuhvs(void)
>          pout += sizeof(MMVector);
>
>          for (int j = 0; j < MAX_VEC_SIZE_BYTES / 2; j++) {
> -            expect[i].uh[j] = (buffer0[i].uh[j] * buffer1[i].uh[j]) >> 16;
> +            expect[i].uh[j] =
> +                ((uint32_t)buffer0[i].uh[j] * buffer1[i].uh[j]) >> 16;
>          }
>      }
>
> --
> 2.34.1
>
>

Reply via email to