diff options
author | Subbaraman Narayanamurthy <subbaram@codeaurora.org> | 2017-06-02 11:38:58 -0700 |
---|---|---|
committer | Subbaraman Narayanamurthy <subbaram@codeaurora.org> | 2017-06-05 18:20:04 -0700 |
commit | 4dba5345e14c61b041c0410b3d6614575515a57a (patch) | |
tree | 64945d3356815d12ccf24c7da80cb7c3b216bd10 /arch/arm/kernel/stacktrace.c | |
parent | 5404e35069576a8cd8203065f60975e34a5f727b (diff) |
power: qpnp-fg-gen3: Fix possible integer overflow
Currently, DIV_ROUND_CLOSEST is used while finding the delta
between initial and final cc_soc_sw in terms of percentage. This
can go beyond 32 bits with the intermediate multiplication before
it is down-converted back to less than 32 bits. Fix this.
Also, when the cc_soc_sw delta is less than 50 %, discard the
data so that the last learned capacity won't be updated.
While at it, fix a similar use of DIV_ROUND_CLOSEST in another
place fg_encode_default() where an integer overflow can happen
if it is passed with large integer values.
Change-Id: Ia2b0f5456663a90bcd32a4fed52d1e579cff4e1f
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
Diffstat (limited to 'arch/arm/kernel/stacktrace.c')
0 files changed, 0 insertions, 0 deletions