mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Colin Ian King <colin.king@canonical.com>
To: "Deucher, Alexander" <Alexander.Deucher@amd.com>,
	Alex Deucher <alexdeucher@gmail.com>
Cc: "Koenig, Christian" <Christian.Koenig@amd.com>,
	David Airlie <airlied@linux.ie>,
	"Huang, JinHuiEric" <JinHuiEric.Huang@amd.com>,
	"Zhu, Rex" <Rex.Zhu@amd.com>, "Zhou, Jammy" <Jammy.Zhou@amd.com>,
	"StDenis, Tom" <Tom.StDenis@amd.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Maling list - DRI developers  <dri-devel@lists.freedesktop.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/amd/amdgpu: default to zero number of states if not enabled
Date: Thu, 6 Oct 2016 20:05:58 +0100	[thread overview]
Message-ID: <57F6A096.9040701@canonical.com> (raw)
In-Reply-To: <MWHPR12MB1694B591F5E428FEB8F89EBCF7C70@MWHPR12MB1694.namprd12.prod.outlook.com>

On 06/10/16 20:04, Deucher, Alexander wrote:
>> -----Original Message-----
>> From: Colin Ian King [mailto:colin.king@canonical.com]
>> Sent: Thursday, October 06, 2016 3:04 PM
>> To: Alex Deucher
>> Cc: Deucher, Alexander; Koenig, Christian; David Airlie; Huang, JinHuiEric;
>> Zhu, Rex; Zhou, Jammy; StDenis, Tom; Dan Carpenter; Maling list - DRI
>> developers; LKML
>> Subject: Re: [PATCH] drm/amd/amdgpu: default to zero number of states if
>> not enabled
>>
>> On 06/10/16 19:32, Alex Deucher wrote:
>>> On Thu, Oct 6, 2016 at 2:02 PM, Colin King <colin.king@canonical.com>
>> wrote:
>>>> From: Colin Ian King <colin.king@canonical.com>
>>>>
>>>> Currently, if adev->pp_enabled is false then the pp_stats_info data
>>>> is not read and hence a garbage number of states from the stack
>>>> is used to dump out the number of states. Given data.nums could be
>>>> any random value, this could easily lead to read outside the
>>>> data.states array.  Fix this by setting data.nums to zero if
>>>> adev->pp_enabled is false.
>>>
>>> Are you actually seeing a problem?
>>
>> Nope.
>>
>>> The pp_num_states attribute only
>>> gets added in the first place if pp_enabled is true.
>>
>> Does that mean that the check on adev->pp_enabled is redundant then?
> 
> Yes, I think so.

OK, in which case it's probably extraneous code that could be removed.
> 
> Alex
> 
>>
>>>
>>> Alex
>>
>>>
>>>>
>>>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>>>> ---
>>>>  drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 2 ++
>>>>  1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
>>>> index accc908..808d788 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
>>>> @@ -195,6 +195,8 @@ static ssize_t amdgpu_get_pp_num_states(struct
>> device *dev,
>>>>
>>>>         if (adev->pp_enabled)
>>>>                 amdgpu_dpm_get_pp_num_states(adev, &data);
>>>> +       else
>>>> +               data.nums = 0;
>>>>
>>>>         buf_len = snprintf(buf, PAGE_SIZE, "states: %d\n", data.nums);
>>>>         for (i = 0; i < data.nums; i++)
>>>> --
>>>> 2.9.3
>>>>
>>>> _______________________________________________
>>>> dri-devel mailing list
>>>> dri-devel@lists.freedesktop.org
>>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

      reply	other threads:[~2016-10-06 19:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-06 18:02 Colin King
2016-10-06 18:32 ` Alex Deucher
2016-10-06 19:03   ` Colin Ian King
2016-10-06 19:04     ` Deucher, Alexander
2016-10-06 19:05       ` Colin Ian King [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=57F6A096.9040701@canonical.com \
    --to=colin.king@canonical.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=Jammy.Zhou@amd.com \
    --cc=JinHuiEric.Huang@amd.com \
    --cc=Rex.Zhu@amd.com \
    --cc=Tom.StDenis@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexdeucher@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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

Powered by JetHome