[PATCH libdrm] amdgpu: Fix a structure initialization issue

Pan, Xinhui Xinhui.Pan at amd.com
Thu Apr 11 11:41:54 UTC 2019


struct drmPciBusInfo has been aligned to 6 bytes. So memcmp will access
the last byte which is not initialized. That causes the lookup function fails.

Signed-off-by: xinhui pan <xinhui.pan at amd.com>
---
 tests/amdgpu/ras_tests.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/amdgpu/ras_tests.c b/tests/amdgpu/ras_tests.c
index 612ad1d7..ebe774fc 100644
--- a/tests/amdgpu/ras_tests.c
+++ b/tests/amdgpu/ras_tests.c
@@ -190,7 +190,7 @@ static int amdgpu_ras_lookup_id(drmDevicePtr device)
 {
 	char path[1024];
 	char str[128];
-	drmPciBusInfo info;
+	drmPciBusInfo info = {0};
 	int i;
 	int ret;
 
-- 
2.17.1



More information about the amd-gfx mailing list