From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF1851741FB; Wed, 3 Jul 2024 10:46:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720003601; cv=none; b=B0YYAalm4yLchkhJRL+9Lh0WgAJ6eXCjBWckC+XJtrwFIa0dEw1tf6ntU+QhBPApJySX+rD57IM9HwsC49Wr5YmHEGX8TYi7gySQd/9IGGUko28QUZufvhCXKb7LwrxdnKxBFDbmLGQSHvcqGYP0VwKikadjTAwGj/y152XNQkg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720003601; c=relaxed/simple; bh=Bpbtlpg/xQ/faa0nwyRU+3xeHVba8GBkjSv8I/vvqVg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=B7pbcCfbncGOXyhoKcOAkQTaFIKKz9GLlCQ4xTw45ZFSM+3q1JJMfWW+n/DDEVVn4QnJYXtQp4jtz4+rRFNPldgzVHEHS8CvDDbzSVOIkl4iozlgEgMtQ8g+z2mOHJVhssawIfgNqu94EMT8PvPF/PAMJfs/43DYt/A5SLFUecA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=0C4Bs0Uq; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="0C4Bs0Uq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E803C2BD10; Wed, 3 Jul 2024 10:46:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1720003601; bh=Bpbtlpg/xQ/faa0nwyRU+3xeHVba8GBkjSv8I/vvqVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0C4Bs0UqcSszVQs32Qbmyp3KBvZO4cU50YUJbE8jSGNmFOA1/9vKNctAnKew41Bi6 GRxX9e0Dj9LtmCu8NCgiWase4dtytscyvM1Inf51lODHfPpk1C7b3DjVhBLLqf7EFb lJmjMO4pyhn6OM5nH0k5dcUES8sVfpK+v7+sM24k= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mario Limonciello , Alex Deucher , Sasha Levin Subject: [PATCH 4.19 103/139] drm/amdgpu: fix UBSAN warning in kv_dpm.c Date: Wed, 3 Jul 2024 12:40:00 +0200 Message-ID: <20240703102834.332635332@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240703102830.432293640@linuxfoundation.org> References: <20240703102830.432293640@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alex Deucher [ Upstream commit f0d576f840153392d04b2d52cf3adab8f62e8cb6 ] Adds bounds check for sumo_vid_mapping_entry. Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3392 Reviewed-by: Mario Limonciello Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/kv_dpm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c index 91a1628cd48fc..77a8d94b8ac76 100644 --- a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c @@ -164,6 +164,8 @@ static void sumo_construct_vid_mapping_table(struct amdgpu_device *adev, for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) { if (table[i].ulSupportedSCLK != 0) { + if (table[i].usVoltageIndex >= SUMO_MAX_NUMBER_VOLTAGES) + continue; vid_mapping_table->entries[table[i].usVoltageIndex].vid_7bit = table[i].usVoltageID; vid_mapping_table->entries[table[i].usVoltageIndex].vid_2bit = -- 2.43.0