plugins/amdgpu: Fix logging of failures to open files during restore init

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 <tvrtko.ursulin@igalia.com>
Reviewed-By: David Francis <David.Francis@amd.com>
This commit is contained in:
Tvrtko Ursulin 2026-02-13 08:54:59 +00:00 committed by Andrei Vagin
parent b1281444a8
commit e26ed51633

View file

@ -1132,7 +1132,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;
@ -1154,7 +1153,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;
@ -1163,7 +1162,7 @@ int amdgpu_restore_init(void)
fclose(img_fp);
e = criu_kfd__unpack(NULL, img_size, buf);
if (!e) {
pr_err("Unable to unpack %s!\n", img_path);
pr_err("Unable to unpack %s!\n", dir->d_name);
xfree(buf);
return -EINVAL;
}
@ -1184,7 +1183,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;
@ -1193,7 +1192,7 @@ int amdgpu_restore_init(void)
fclose(img_fp);
rd = criu_render_node__unpack(NULL, img_size, buf);
if (!rd) {
pr_err("Unable to unpack %s!\n", img_path);
pr_err("Unable to unpack %s!\n", dir->d_name);
xfree(buf);
return -EINVAL;
}