[PATCH v2 05/23] plugins/amdgpu: Fix logging of failures to open files during restore init

Tvrtko Ursulin <[email protected]> Fri, 10 Apr 2026 19:54:56 +0100
Newsgroups dev.linux.lists.criu
Message-ID <[email protected]>
Currently failure to open files logs an unitialized stack string as the
failed path. Lets just log the basename and drop the unused stack buffer.

Signed-off-by: Tvrtko Ursulin <[email protected]>
Reviewed-By: David Francis <[email protected]>
---
 plugins/amdgpu/amdgpu_plugin.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c
index 1a029049173c..a55e6cef96c4 100644
--- a/plugins/amdgpu/amdgpu_plugin.c
+++ b/plugins/amdgpu/amdgpu_plugin.c
@@ -1130,7 +1130,6 @@ int amdgpu_restore_init(void)
 		int ret;
 		unsigned char *buf;
 		int num_handles = 0;
-		char img_path[PATH_MAX];
 		CriuRenderNode *rd = NULL;
 		CriuKfd *e = NULL;
 
@@ -1152,7 +1151,7 @@ int amdgpu_restore_init(void)
 
 					ret = read_fp(img_fp, buf, img_size);
 					if (ret) {
-						pr_perror("Unable to read from %s", img_path);
+						pr_perror("Unable to read from %s", dir->d_name);
 						fclose(img_fp);
 						xfree(buf);
 						return ret;
@@ -1177,7 +1176,7 @@ int amdgpu_restore_init(void)
 
 					ret = read_fp(img_fp, buf, img_size);
 					if (ret) {
-						pr_perror("Unable to read from %s", img_path);
+						pr_perror("Unable to read from %s", dir->d_name);
 						fclose(img_fp);
 						xfree(buf);
 						return ret;
-- 
2.52.0