From: "Christian König" <christian.koenig@amd.com>
To: Arnd Bergmann <arnd@arndb.de>,
Alex Deucher <alexander.deucher@amd.com>,
"David (ChunMing) Zhou" <David1.Zhou@amd.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
Evan Quan <evan.quan@amd.com>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>,
Andrey Grodzovsky <andrey.grodzovsky@amd.com>,
Monk Liu <Monk.Liu@amd.com>, Kent Russell <kent.russell@amd.com>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com
Subject: Re: [PATCH] amdgpu: fix integer overflow on 32-bit architectures
Date: Tue, 5 May 2020 16:16:57 +0200 [thread overview]
Message-ID: <e4a852b2-807b-bc73-7328-bcc399341085@amd.com> (raw)
In-Reply-To: <20200505141606.837164-1-arnd@arndb.de>
Am 05.05.20 um 16:15 schrieb Arnd Bergmann:
> Multiplying 1000000000 by four overruns a 'long' variable, as clang
> points out:
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:4160:53: error: overflow in expression; result is -294967296 with type 'long' [-Werror,-Winteger-overflow]
> expires = ktime_get_mono_fast_ns() + NSEC_PER_SEC * 4L;
> ^
> Make this a 'long long' constant instead.
>
> Fixes: 3f12acc8d6d4 ("drm/amdgpu: put the audio codec into suspend state before gpu reset V3")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
> I'm not sure the ktime_get_mono_fast_ns() call is necessary here
> either. Is it intentional because ktime_get_ns() doesn't work
> during a driver suspend, or just a mistake?
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 6f93af972b0a..2e07e3e6b036 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -4157,7 +4157,7 @@ static int amdgpu_device_suspend_display_audio(struct amdgpu_device *adev)
> * the audio controller default autosuspend delay setting.
> * 4S used here is guaranteed to cover that.
> */
> - expires = ktime_get_mono_fast_ns() + NSEC_PER_SEC * 4L;
> + expires = ktime_get_mono_fast_ns() + NSEC_PER_SEC * 4LL;
>
> while (!pm_runtime_status_suspended(&(p->dev))) {
> if (!pm_runtime_suspend(&(p->dev)))
next prev parent reply other threads:[~2020-05-05 14:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-05 14:15 [PATCH] amdgpu: fix integer overflow on 32-bit architectures Arnd Bergmann
2020-05-05 14:16 ` Christian König [this message]
2020-05-05 15:39 ` Nick Desaulniers
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=e4a852b2-807b-bc73-7328-bcc399341085@amd.com \
--to=christian.koenig@amd.com \
--cc=David1.Zhou@amd.com \
--cc=Hawking.Zhang@amd.com \
--cc=Monk.Liu@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=andrey.grodzovsky@amd.com \
--cc=arnd@arndb.de \
--cc=clang-built-linux@googlegroups.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=evan.quan@amd.com \
--cc=kent.russell@amd.com \
--cc=linux-kernel@vger.kernel.org \
/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