mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
BACKPORT: rtc: qpnp: fix unintended sign extension
[ Upstream commit e42280886018c6f77f0a90190f7cba344b0df3e0 ] Shifting a u8 by 24 will cause the value to be promoted to an integer. If the top bit of the u8 is set then the following conversion to an unsigned long will sign extend the value causing the upper 32 bits to be set in the result. Fix this by casting the u8 value to an unsigned long before the shift. Detected by CoverityScan, CID#1309693 ("Unintended sign extension") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Andrzej Perczak <linux@andrzejperczak.com> Change-Id: Ie50f3c49e2ad9b23b41ed4e904630f4e991e1694 Signed-off-by: azrim <mirzaspc@gmail.com>
This commit is contained in:
parent
099c263bc3
commit
0051465172
@ -46,7 +46,7 @@
|
||||
#define NUM_8_BIT_RTC_REGS 0x4
|
||||
|
||||
#define TO_SECS(arr) (arr[0] | (arr[1] << 8) | (arr[2] << 16) | \
|
||||
(arr[3] << 24))
|
||||
((unsigned long)arr[3] << 24))
|
||||
|
||||
/* Module parameter to control power-on-alarm */
|
||||
bool poweron_alarm;
|
||||
|
Loading…
x
Reference in New Issue
Block a user