From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: Ma Jun <Jun.Ma2@amd.com>,
amd-gfx@lists.freedesktop.org, christian.koenig@amd.com,
Alexander.Deucher@amd.com
Subject: Re: [PATCH v2 2/2] drm/amdgpu: Fix the uninitialized variable warning
Date: Thu, 25 Apr 2024 15:40:16 +0530 [thread overview]
Message-ID: <c9813334-3ec0-4095-930f-e4ecea3125b0@amd.com> (raw)
In-Reply-To: <20240425100027.637016-3-Jun.Ma2@amd.com>
On 4/25/2024 3:30 PM, Ma Jun wrote:
> Initialize the phy_id to 0 to fix the warning of
> "Using uninitialized value phy_id"
>
> Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> index 8ed0e073656f..53d85fafd8ab 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> @@ -95,7 +95,7 @@ static ssize_t amdgpu_securedisplay_debugfs_write(struct file *f, const char __u
> struct psp_context *psp = &adev->psp;
> struct ta_securedisplay_cmd *securedisplay_cmd;
> struct drm_device *dev = adev_to_drm(adev);
> - uint32_t phy_id;
> + uint32_t phy_id = 0;
> uint32_t op;
> char str[64];
> int ret;
> @@ -135,6 +135,10 @@ static ssize_t amdgpu_securedisplay_debugfs_write(struct file *f, const char __u
> mutex_unlock(&psp->securedisplay_context.mutex);
> break;
> case 2:
> + if (size < 3) {
> + dev_err(adev->dev, "Invalid input: %s\n", str);
> + return -EINVAL;
> + }
Better is to check the return of sscanf to see if phy_id value is
successfully scanned. Otherwise, return error.
Thanks,
Lijo
> mutex_lock(&psp->securedisplay_context.mutex);
> psp_prep_securedisplay_cmd_buf(psp, &securedisplay_cmd,
> TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC);
next prev parent reply other threads:[~2024-04-25 10:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-25 10:00 [PATCH] drm/amdgpu: Fix out-of-bounds write warning Ma Jun
2024-04-25 10:00 ` [PATCH v2 1/2] drm/amdgpu: Fix uninitialized variable warning in amdgpu_afmt_acr Ma Jun
2024-04-25 13:14 ` Alex Deucher
2024-04-25 10:00 ` [PATCH v2 2/2] drm/amdgpu: Fix the uninitialized variable warning Ma Jun
2024-04-25 10:10 ` Lazar, Lijo [this message]
2024-04-26 3:08 ` Ma, Jun
2024-04-25 13:12 ` Alex Deucher
2024-04-25 12:39 ` [PATCH] drm/amdgpu: Fix out-of-bounds write warning Christian König
2024-04-26 3:24 ` Ma, Jun
2024-04-26 7:38 ` Christian König
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=c9813334-3ec0-4095-930f-e4ecea3125b0@amd.com \
--to=lijo.lazar@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Jun.Ma2@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.