diff options
author | Colin Ian King <colin.king@canonical.com> | 2018-02-15 22:36:14 +0300 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-03-01 12:49:38 +0300 |
commit | 347876ad47b9923ce26e686173bbf46581802ffa (patch) | |
tree | ef1cf730fd20beae4fc7cf58805624a678f4df0e /drivers/rtc/rtc-ds1511.c | |
parent | e6a0b0f4085c9a56fa50c9666ee662d197c4707d (diff) | |
download | linux-347876ad47b9923ce26e686173bbf46581802ffa.tar.xz |
rtc: tx4939: avoid unintended sign extension on a 24 bit shift
The shifting of buf[5] by 24 bits to the left will be promoted to
a 32 bit signed int and then sign-extended to an unsigned long. If
the top bit of buf[5] is set then all then all the upper bits sec
end up as also being set because of the sign-extension. Fix this by
casting buf[5] to an unsigned long before the shift.
Detected by CoverityScan, CID#1465292 ("Unintended sign extension")
Fixes: 0e1492330cd2 ("rtc: add rtc-tx4939 driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-ds1511.c')
0 files changed, 0 insertions, 0 deletions