aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/4281-drm-amdkfd-fix-uninitialized-variable-use.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/4281-drm-amdkfd-fix-uninitialized-variable-use.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.14.71/4281-drm-amdkfd-fix-uninitialized-variable-use.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/4281-drm-amdkfd-fix-uninitialized-variable-use.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/4281-drm-amdkfd-fix-uninitialized-variable-use.patch
new file mode 100644
index 00000000..6668bb94
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/4281-drm-amdkfd-fix-uninitialized-variable-use.patch
@@ -0,0 +1,42 @@
+From 399e87d6ca79deb20aad8b2b5cbc22b6b9089e2e Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Thu, 15 Mar 2018 17:49:40 +0100
+Subject: [PATCH 4281/5725] drm/amdkfd: fix uninitialized variable use
+
+When CONFIG_ACPI is disabled, we never initialize the acpi_table
+structure in kfd_create_crat_image_virtual:
+
+drivers/gpu/drm/amd/amdkfd/kfd_crat.c: In function 'kfd_create_crat_image_virtual':
+drivers/gpu/drm/amd/amdkfd/kfd_crat.c:888:40: error: 'acpi_table' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+
+The undefined behavior also happens for any other acpi_get_table()
+failure, but then the compiler can't warn about it.
+
+This adds an error check that prevents the structure from
+being used in error, avoiding both the undefined behavior and
+the warning about it.
+
+Change-Id: Ib90f712f6964f4c94f65f8c3a9153ac51f65504c
+Fixes: 520b8fb755cc ("drm/amdkfd: Add topology support for CPUs")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
+---
+ drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
+index 24d0634..a803898 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
+@@ -915,7 +915,7 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size)
+
+ #ifdef CONFIG_ACPI
+ status = acpi_get_table("DSDT", 0, &acpi_table);
+- if (status == AE_NOT_FOUND)
++ if (status != AE_OK)
+ pr_warn("DSDT table not found for OEM information\n");
+ else {
+ crat_table->oem_revision = acpi_table->revision;
+--
+2.7.4
+