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

Tvrtko Ursulin <[email protected]> Wed, 11 Mar 2026 09:58:53 +0000
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 e2fe4bd8a823..1ec133de262d 100644
--- a/plugins/amdgpu/amdgpu_plugin_drm.c
+++ b/plugins/amdgpu/amdgpu_plugin_drm.c
@@ -378,6 +378,7 @@ int amdgpu_plugin_drm_dump_file(int fd, int id, struct stat *drm)
 		drmPrimeHandleToFD(device_fd, boinfo->handle, 0, &dmabuf_fd);
 
 		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);
 
 		posix_memalign(&buffer, sysconf(_SC_PAGE_SIZE), handle_entry.size);
-- 
2.52.0