aboutsummaryrefslogtreecommitdiff
path: root/scripts/archive-source.sh
diff options
context:
space:
mode:
authorHao Wu <wuhaotsh@google.com>2021-01-26 17:11:42 -0800
committerPeter Maydell <peter.maydell@linaro.org>2021-01-29 10:47:28 +0000
commit1e5ce6e10a1deaec6044ba8ad75431e0424dbce9 (patch)
tree6f2110eeb591c05111c4c95886f6d185956b99c0 /scripts/archive-source.sh
parentdaa726d92604b72650d86ada01935e03a909d4dd (diff)
hw/misc: Fix arith overflow in NPCM7XX PWM module
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.maydell@linaro.org> Reviewed-by: Doug Evans <dje@google.com> Signed-off-by: Hao Wu <wuhaotsh@google.com> Message-id: 20210127011142.2122790-1-wuhaotsh@google.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'scripts/archive-source.sh')
0 files changed, 0 insertions, 0 deletions