aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3236-drm-amd-powerplay-fix-off-by-one-upper-bounds-limit-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3236-drm-amd-powerplay-fix-off-by-one-upper-bounds-limit-.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3236-drm-amd-powerplay-fix-off-by-one-upper-bounds-limit-.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3236-drm-amd-powerplay-fix-off-by-one-upper-bounds-limit-.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3236-drm-amd-powerplay-fix-off-by-one-upper-bounds-limit-.patch
new file mode 100644
index 00000000..0c16f2ba
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3236-drm-amd-powerplay-fix-off-by-one-upper-bounds-limit-.patch
@@ -0,0 +1,43 @@
+From 53619aa32a5b2a5f3909b8f87bc10de7c6770bb9 Mon Sep 17 00:00:00 2001
+From: Colin Ian King <colin.king@canonical.com>
+Date: Thu, 1 Aug 2019 12:15:41 +0100
+Subject: [PATCH 3236/4256] drm/amd/powerplay: fix off-by-one upper bounds
+ limit checks
+
+There are two occurrances of off-by-one upper bound checking of indexes
+causing potential out-of-bounds array reads. Fix these.
+
+Addresses-Coverity: ("Out-of-bounds read")
+Fixes: cb33363d0e85 ("drm/amd/powerplay: add smu feature name support")
+Fixes: 6b294793e384 ("drm/amd/powerplay: add smu message name support")
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+index 8641b3a8f81e..70522aa6a7b2 100644
+--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
++++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+@@ -38,7 +38,7 @@ static const char* __smu_message_names[] = {
+
+ const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type)
+ {
+- if (type < 0 || type > SMU_MSG_MAX_COUNT)
++ if (type < 0 || type >= SMU_MSG_MAX_COUNT)
+ return "unknow smu message";
+ return __smu_message_names[type];
+ }
+@@ -51,7 +51,7 @@ static const char* __smu_feature_names[] = {
+
+ const char *smu_get_feature_name(struct smu_context *smu, enum smu_feature_mask feature)
+ {
+- if (feature < 0 || feature > SMU_FEATURE_COUNT)
++ if (feature < 0 || feature >= SMU_FEATURE_COUNT)
+ return "unknow smu feature";
+ return __smu_feature_names[feature];
+ }
+--
+2.17.1
+