The div64_u64_rem() function takes a u64 as a remainder. Passing an int
pointer to it will result in memory corruption. Change
"remaining_seconds" from int to u64.
Fixes: ace232eff50e ("drm/amdgpu: Add ras module files into amdgpu")
Signed-off-by: Dan Carpenter <[email protected]>
---
drivers/gpu/drm/amd/ras/rascore/ras_core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/ras/rascore/ras_core.c
b/drivers/gpu/drm/amd/ras/rascore/ras_core.c
index 01122b55c98a..d8a004878a64 100644
--- a/drivers/gpu/drm/amd/ras/rascore/ras_core.c
+++ b/drivers/gpu/drm/amd/ras/rascore/ras_core.c
@@ -67,9 +67,10 @@ int ras_core_convert_timestamp_to_time(struct
ras_core_context *ras_core,
int seconds_per_day = 24 * 60 * 60;
int seconds_per_hour = 60 * 60;
int seconds_per_minute = 60;
- int days, remaining_seconds;
+ uint64_t remaining_seconds;
+ int days;
- days = div64_u64_rem(timestamp, seconds_per_day, (uint64_t
*)&remaining_seconds);
+ days = div64_u64_rem(timestamp, seconds_per_day, &remaining_seconds);
/* utc_timestamp follows the Unix epoch */
year = 1970;
--
2.51.0