From: Alex Deucher <alexdeucher@gmail.com>
To: Tom Rix <trix@redhat.com>
Cc: "Deucher, Alexander" <alexander.deucher@amd.com>,
Christian Koenig <christian.koenig@amd.com>,
xinhui pan <Xinhui.Pan@amd.com>, Dave Airlie <airlied@linux.ie>,
Daniel Vetter <daniel@ffwll.ch>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
"Tuikov, Luben" <luben.tuikov@amd.com>,
"Nieto, David M" <david.nieto@amd.com>,
Nirmoy Das <nirmoy.das@amd.com>, "Xue, Ken" <Ken.Xue@amd.com>,
Roy Sun <Roy.Sun@amd.com>, "Quan, Evan" <evan.quan@amd.com>,
llvm@lists.linux.dev,
Maling list - DRI developers <dri-devel@lists.freedesktop.org>,
amd-gfx list <amd-gfx@lists.freedesktop.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/amdgpu: check return status before using stable_pstate
Date: Mon, 14 Feb 2022 13:25:55 -0500 [thread overview]
Message-ID: <CADnq5_MrrTXmVPv7ukkpq-+WWn7cKbF9CHjhsBnuRzqbriUN1g@mail.gmail.com> (raw)
In-Reply-To: <20220214182224.2906060-1-trix@redhat.com>
Applied. Thanks!
Alex
On Mon, Feb 14, 2022 at 1:22 PM <trix@redhat.com> wrote:
>
> From: Tom Rix <trix@redhat.com>
>
> Clang static analysis reports this problem
> amdgpu_ctx.c:616:26: warning: Assigned value is garbage
> or undefined
> args->out.pstate.flags = stable_pstate;
> ^ ~~~~~~~~~~~~~
> amdgpu_ctx_stable_pstate can fail without setting
> stable_pstate. So check.
>
> Fixes: 8cda7a4f96e4 ("drm/amdgpu/UAPI: add new CTX OP to get/set stable pstates")
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> index 1c72f6095f08..f522b52725e4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> @@ -613,7 +613,8 @@ int amdgpu_ctx_ioctl(struct drm_device *dev, void *data,
> if (args->in.flags)
> return -EINVAL;
> r = amdgpu_ctx_stable_pstate(adev, fpriv, id, false, &stable_pstate);
> - args->out.pstate.flags = stable_pstate;
> + if (!r)
> + args->out.pstate.flags = stable_pstate;
> break;
> case AMDGPU_CTX_OP_SET_STABLE_PSTATE:
> if (args->in.flags & ~AMDGPU_CTX_STABLE_PSTATE_FLAGS_MASK)
> --
> 2.26.3
>
prev parent reply other threads:[~2022-02-14 18:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-14 18:22 [PATCH] drm/amdgpu: check return status before using stable_pstate trix
2022-02-14 18:25 ` Alex Deucher [this message]
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=CADnq5_MrrTXmVPv7ukkpq-+WWn7cKbF9CHjhsBnuRzqbriUN1g@mail.gmail.com \
--to=alexdeucher@gmail.com \
--cc=Ken.Xue@amd.com \
--cc=Roy.Sun@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=david.nieto@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=evan.quan@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=luben.tuikov@amd.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nirmoy.das@amd.com \
--cc=trix@redhat.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;
as well as URLs for NNTP newsgroup(s).