public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Tim Huang <Tim.Huang@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Sasha Levin <sashal@kernel.org>,
	christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com,
	daniel@ffwll.ch, srinivasan.shanmugam@amd.com,
	guchun.chen@amd.com, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org
Subject: [PATCH AUTOSEL 4.19 02/14] drm/amdgpu: fix ucode out-of-bounds read warning
Date: Wed, 31 Jul 2024 20:40:10 -0400	[thread overview]
Message-ID: <20240801004037.3939932-2-sashal@kernel.org> (raw)
In-Reply-To: <20240801004037.3939932-1-sashal@kernel.org>

From: Tim Huang <Tim.Huang@amd.com>

[ Upstream commit 8944acd0f9db33e17f387fdc75d33bb473d7936f ]

Clear warning that read ucode[] may out-of-bounds.

Signed-off-by: Tim Huang <Tim.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
index 387f1cf1dc207..9e768ff392fec 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
@@ -212,6 +212,9 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
 		struct amdgpu_firmware_info *ucode;
 
 		id = fw_type_convert(cgs_device, type);
+		if (id >= AMDGPU_UCODE_ID_MAXIMUM)
+			return -EINVAL;
+
 		ucode = &adev->firmware.ucode[id];
 		if (ucode->fw == NULL)
 			return -EINVAL;
-- 
2.43.0


  reply	other threads:[~2024-08-01  0:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-01  0:40 [PATCH AUTOSEL 4.19 01/14] drm/amdgpu: fix overflowed array index read warning Sasha Levin
2024-08-01  0:40 ` Sasha Levin [this message]
2024-08-01  0:40 ` [PATCH AUTOSEL 4.19 03/14] drm/amdgpu: fix mc_data out-of-bounds " Sasha Levin
2024-08-01  0:40 ` [PATCH AUTOSEL 4.19 04/14] drm/amdkfd: Reconcile the definition and use of oem_id in struct kfd_topology_device Sasha Levin
2024-08-01  0:40 ` [PATCH AUTOSEL 4.19 05/14] smack: tcp: ipv4, fix incorrect labeling Sasha Levin
2024-08-01  0:40 ` [PATCH AUTOSEL 4.19 06/14] ELF: fix kernel.randomize_va_space double read Sasha Levin
2024-08-27 12:18   ` Pavel Machek
2024-08-01  0:40 ` [PATCH AUTOSEL 4.19 07/14] udf: Avoid excessive partition lengths Sasha Levin
2024-08-01  0:40 ` [PATCH AUTOSEL 4.19 08/14] cgroup: Protect css->cgroup write under css_set_lock Sasha Levin
2024-08-01  0:40 ` [PATCH AUTOSEL 4.19 09/14] um: line: always fill *error_out in setup_one_line() Sasha Levin
2024-08-01  0:40 ` [PATCH AUTOSEL 4.19 10/14] devres: Initialize an uninitialized struct member Sasha Levin
2024-08-01  0:40 ` [PATCH AUTOSEL 4.19 11/14] pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv Sasha Levin
2024-08-01  0:40 ` [PATCH AUTOSEL 4.19 12/14] hwmon: (lm95234) Fix underflows seen when writing limit attributes Sasha Levin
2024-08-01  0:40 ` [PATCH AUTOSEL 4.19 13/14] hwmon: (w83627ehf) " Sasha Levin
2024-08-01  0:40 ` [PATCH AUTOSEL 4.19 14/14] wifi: mwifiex: Do not return unused priv in mwifiex_get_priv_by_id() Sasha Levin

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=20240801004037.3939932-2-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=Tim.Huang@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=guchun.chen@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivasan.shanmugam@amd.com \
    --cc=stable@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