mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
rtc: fix coverity defects
CID 10166554: Unintentional integer overflow defect. Fixes by typecasting ret of signed 32bit value to signed 64bit value. Bug 3952896 Change-Id: I35cbc8bf3e9eb906688f9bb27953d1e5bf76633d Signed-off-by: Shubhi Garg <shgarg@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2864836 Reviewed-by: svcacv <svcacv@nvidia.com> Reviewed-by: Sachin Nikam <snikam@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
8a61c9f119
commit
1fa3407928
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
* RTC driver for NVIDIA Voltage Regulator Power Sequencer
|
* RTC driver for NVIDIA Voltage Regulator Power Sequencer
|
||||||
*
|
*
|
||||||
* Copyright (C) 2022 NVIDIA CORPORATION. All rights reserved.
|
* Copyright (C) 2022-2023 NVIDIA CORPORATION. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/i2c.h>
|
#include <linux/i2c.h>
|
||||||
@@ -214,7 +214,7 @@ static int nvvrs_rtc_read_time(struct device *dev, struct rtc_time *tm)
|
|||||||
info->drv_data->map[RTC_T3], ret);
|
info->drv_data->map[RTC_T3], ret);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
secs |= ret << 24;
|
secs |= (time64_t)ret << 24;
|
||||||
|
|
||||||
ret = i2c_smbus_read_byte_data(client, info->drv_data->map[RTC_T2]);
|
ret = i2c_smbus_read_byte_data(client, info->drv_data->map[RTC_T2]);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@@ -222,7 +222,7 @@ static int nvvrs_rtc_read_time(struct device *dev, struct rtc_time *tm)
|
|||||||
info->drv_data->map[RTC_T2], ret);
|
info->drv_data->map[RTC_T2], ret);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
secs |= ret << 16;
|
secs |= (time64_t)ret << 16;
|
||||||
|
|
||||||
ret = i2c_smbus_read_byte_data(client, info->drv_data->map[RTC_T1]);
|
ret = i2c_smbus_read_byte_data(client, info->drv_data->map[RTC_T1]);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@@ -230,7 +230,7 @@ static int nvvrs_rtc_read_time(struct device *dev, struct rtc_time *tm)
|
|||||||
info->drv_data->map[RTC_T1], ret);
|
info->drv_data->map[RTC_T1], ret);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
secs |= ret << 8;
|
secs |= (time64_t)ret << 8;
|
||||||
|
|
||||||
ret = i2c_smbus_read_byte_data(client, info->drv_data->map[RTC_T0]);
|
ret = i2c_smbus_read_byte_data(client, info->drv_data->map[RTC_T0]);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user