On Wed, 27 Jan 2021 at 01:11, Hao Wu <[email protected]> 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 <[email protected]>
> Reviewed-by: Doug Evans <[email protected]>
> Signed-off-by: Hao Wu <[email protected]>
> ---



Applied to target-arm.next, thanks.

-- PMM

Reply via email to