On Wed, 27 Jan 2021 at 01:11, Hao Wu <wuhao...@google.com> wrote:
>
> Fix potential overflow problem when calculating pwm_duty.
> 1. Ensure p->cmr and p->cnr to be from [0,65535], according to the
>    hardware specification.
> 2. Changed duty to uint32_t. However, since MAX_DUTY * (p->cmr+1)
>    can excceed UINT32_MAX, we convert them to uint64_t in computation
>    and converted them back to uint32_t.
>    (duty is guaranteed to be <= MAX_DUTY so it won't overflow.)
>
> Fixes: CID 1442342
> Suggested-by: Peter Maydell <peter.mayd...@linaro.org>
> Reviewed-by: Doug Evans <d...@google.com>
> Signed-off-by: Hao Wu <wuhao...@google.com>
> ---



Applied to target-arm.next, thanks.

-- PMM

Reply via email to