From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Xinhui Pan" <Xinhui.Pan@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Hawking Zhang" <Hawking.Zhang@amd.com>,
"Yunxiang Li" <Yunxiang.Li@amd.com>,
"Srinivasan Shanmugam" <srinivasan.shanmugam@amd.com>,
"Dr. David Alan Gilbert" <linux@treblig.org>,
"Rajneesh Bhardwaj" <rajneesh.bhardwaj@amd.com>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH next] drm/amdgpu: Fix off by one in current_memory_partition_show()
Date: Fri, 11 Oct 2024 08:35:55 +0530 [thread overview]
Message-ID: <a1acb975-c29e-4c90-b7a9-5f50478ab946@amd.com> (raw)
In-Reply-To: <f3cf409f-2b04-444f-88f0-9b4cfe290667@stanley.mountain>
On 10/11/2024 12:05 AM, Dan Carpenter wrote:
> The >= ARRAY_SIZE() should be > ARRAY_SIZE() to prevent an out of
> bounds read.
>
> Fixes: 012be6f22c01 ("drm/amdgpu: Add sysfs interfaces for NPS mode")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Thanks,
Lijo
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> index ddf716d27f3a..75c9291ac3eb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> @@ -1199,7 +1199,7 @@ static ssize_t current_memory_partition_show(
> enum amdgpu_memory_partition mode;
>
> mode = adev->gmc.gmc_funcs->query_mem_partition_mode(adev);
> - if ((mode > ARRAY_SIZE(nps_desc)) ||
> + if ((mode >= ARRAY_SIZE(nps_desc)) ||
> (BIT(mode) & AMDGPU_ALL_NPS_MASK) != BIT(mode))
> return sysfs_emit(buf, "UNKNOWN\n");
>
next prev parent reply other threads:[~2024-10-11 3:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-10 18:35 Dan Carpenter
2024-10-11 3:05 ` Lazar, Lijo [this message]
2024-10-14 18:04 ` Alex Deucher
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=a1acb975-c29e-4c90-b7a9-5f50478ab946@amd.com \
--to=lijo.lazar@amd.com \
--cc=Hawking.Zhang@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=Yunxiang.Li@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dan.carpenter@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@treblig.org \
--cc=rajneesh.bhardwaj@amd.com \
--cc=simona@ffwll.ch \
--cc=srinivasan.shanmugam@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®