All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ma, Jun" <majun@amd.com>
To: "Lazar, Lijo" <lijo.lazar@amd.com>, Ma Jun <Jun.Ma2@amd.com>,
	amd-gfx@lists.freedesktop.org, christian.koenig@amd.com,
	Alexander.Deucher@amd.com
Cc: majun@amd.com
Subject: Re: [PATCH v2 2/2] drm/amdgpu: Fix the uninitialized variable warning
Date: Fri, 26 Apr 2024 11:08:07 +0800	[thread overview]
Message-ID: <a5526673-3275-4636-80f7-abbe468f4a32@amd.com> (raw)
In-Reply-To: <c9813334-3ec0-4095-930f-e4ecea3125b0@amd.com>



On 4/25/2024 6:10 PM, Lazar, Lijo wrote:
> 
> 
> 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, will fix in v3

Regards,
Ma Jun
> 
> Thanks,
> Lijo
> 
>>  		mutex_lock(&psp->securedisplay_context.mutex);
>>  		psp_prep_securedisplay_cmd_buf(psp, &securedisplay_cmd,
>>  			TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC);

  reply	other threads:[~2024-04-26  3:08 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
2024-04-26  3:08     ` Ma, Jun [this message]
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=a5526673-3275-4636-80f7-abbe468f4a32@amd.com \
    --to=majun@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Jun.Ma2@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=lijo.lazar@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.