From: Dan Carpenter <dan.carpenter@linaro.org>
To: YiPeng Chai <YiPeng.Chai@amd.com>
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>, "Tao Zhou" <tao.zhou1@amd.com>,
"Hawking Zhang" <Hawking.Zhang@amd.com>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH next] drm/amd/ras: Fix memory corruption in ras_core_convert_timestamp_to_time()
Date: Wed, 22 Oct 2025 14:04:03 +0300 [thread overview]
Message-ID: <aPi6I5z5oenppEuu@stanley.mountain> (raw)
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 <dan.carpenter@linaro.org>
---
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
next reply other threads:[~2025-10-23 7:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-22 11:04 Dan Carpenter [this message]
2025-10-23 7:18 ` [PATCH next] drm/amd/ras: Fix memory corruption in ras_core_convert_timestamp_to_time() kernel test robot
2025-10-23 19:38 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aPi6I5z5oenppEuu@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=Hawking.Zhang@amd.com \
--cc=YiPeng.Chai@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=tao.zhou1@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox