]> git.baikalelectronics.ru Git - kernel.git/commit
drm/amdkfd: fix uninitialized variable use
authorArnd Bergmann <arnd@arndb.de>
Thu, 15 Mar 2018 16:49:40 +0000 (17:49 +0100)
committerOded Gabbay <oded.gabbay@gmail.com>
Thu, 15 Mar 2018 16:49:40 +0000 (17:49 +0100)
commite552d85af42f5d09956ed92197fe6eb8ef50053b
tree9be9007d6baa2f887c234e74d172755a7b3d4cee
parent93b953b486f4a201158f672614cfd6ce2bd07dec
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.

Fixes: 69ced486b56b ("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