[PATCH] drm/amdkfd: Fix the warning of array-index-out-of-bounds

Ma Jun Jun.Ma2 at amd.com
Sat Oct 8 05:56:12 UTC 2022


Increasing the simbling array size to fix the warning of
array-index-out-of-bounds. The VCRAT_SIZE_FOR_GPU is also
increased accrordingly.

Signed-off-by: Ma Jun <Jun.Ma2 at amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 2 +-
 drivers/gpu/drm/amd/amdkfd/kfd_crat.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
index 477a30981c1b..3ec425c3737d 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
@@ -1683,7 +1683,7 @@ int kfd_create_crat_image_acpi(void **crat_image, size_t *size)
  * expected to cover all known conditions. But to be safe additional check
  * is put in the code to ensure we don't overwrite.
  */
-#define VCRAT_SIZE_FOR_GPU	(4 * PAGE_SIZE)
+#define VCRAT_SIZE_FOR_GPU	(6 * PAGE_SIZE)
 
 /* kfd_fill_cu_for_cpu - Fill in Compute info for the given CPU NUMA node
  *
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.h b/drivers/gpu/drm/amd/amdkfd/kfd_crat.h
index fbb5f6c32ef5..31a4bbc9f9cb 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.h
@@ -80,7 +80,7 @@ struct crat_header {
 #define CRAT_SUBTYPE_IOLINK_AFFINITY		5
 #define CRAT_SUBTYPE_MAX			6
 
-#define CRAT_SIBLINGMAP_SIZE	32
+#define CRAT_SIBLINGMAP_SIZE	64
 
 /*
  * ComputeUnit Affinity structure and definitions
-- 
2.25.1



More information about the amd-gfx mailing list