[PATCH v2 04/23] plugins/amdgpu: Fix drm pages size header

Tvrtko Ursulin <[email protected]> Fri, 10 Apr 2026 19:54:55 +0100
Newsgroups dev.linux.lists.criu
Message-ID <[email protected]>
Size needs to be initialized before opening the file for write, otherwise
garbage is written into the file.

Signed-off-by: Tvrtko Ursulin <[email protected]>
Reviewed-By: David Francis <[email protected]>
---
 plugins/amdgpu/amdgpu_plugin_drm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/plugins/amdgpu/amdgpu_plugin_drm.c b/plugins/amdgpu/amdgpu_plugin_drm.c
index c51e43eaf491..487c2a1e2a6d 100644
--- a/plugins/amdgpu/amdgpu_plugin_drm.c
+++ b/plugins/amdgpu/amdgpu_plugin_drm.c
@@ -414,6 +414,7 @@ int amdgpu_plugin_drm_dump_file(int fd, int id, struct stat *drm)
 		}
 
 		snprintf(img_path, sizeof(img_path), IMG_DRM_PAGES_FILE, rd->id, rd->drm_render_minor, i);
+		image_size = handle_entry.size;
 		bo_contents_fp = open_img_file(img_path, true, &image_size, true);
 		if (!bo_contents_fp) {
 			ret = -errno;
-- 
2.52.0