From f7e06589a4dc4c0755c2ebce56dcbcefb43d62f1 Mon Sep 17 00:00:00 2001 From: Tvrtko Ursulin Date: Tue, 5 May 2026 09:37:05 +0100 Subject: [PATCH] plugins/amdgpu: Avoid shadowing the minor local in DRM dump file The DRM minor local variable is shadowed between two blocks inside amdgpu_plugin_drm_dump_file(). If at the top level we access the minor via the copy stored in the protobuf image, we can simply drop this copy and so avoid the buffer object dump loop shadowing it. Signed-off-by: Tvrtko Ursulin --- plugins/amdgpu/amdgpu_plugin_drm.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/plugins/amdgpu/amdgpu_plugin_drm.c b/plugins/amdgpu/amdgpu_plugin_drm.c index 2d6a2e85e..06a38f574 100644 --- a/plugins/amdgpu/amdgpu_plugin_drm.c +++ b/plugins/amdgpu/amdgpu_plugin_drm.c @@ -243,9 +243,7 @@ int amdgpu_plugin_drm_dump_file(int fd, int id, struct stat *drm) char path[PATH_MAX]; CriuRenderNode *rd; unsigned char *buf; - int minor; - int len; - int ret; + int len, ret; size_t image_size; struct tp_node *tp_node; struct drm_amdgpu_gem_list_handles list_handles_args = { 0 }; @@ -259,8 +257,7 @@ int amdgpu_plugin_drm_dump_file(int fd, int id, struct stat *drm) criu_render_node__init(rd); /* Get the topology node of the DRM device */ - minor = minor(drm->st_rdev); - rd->drm_render_minor = minor; + rd->drm_render_minor = minor(drm->st_rdev); rd->id = id; num_bos = 8; @@ -454,9 +451,10 @@ int amdgpu_plugin_drm_dump_file(int fd, int id, struct stat *drm) goto exit; } - tp_node = sys_get_node_by_render_minor(&src_topology, minor); + tp_node = sys_get_node_by_render_minor(&src_topology, rd->drm_render_minor); if (!tp_node) { - pr_err("Failed to find a device with minor number = %d\n", minor); + pr_err("Failed to find a device with minor number = %d\n", + rd->drm_render_minor); return -ENODEV; }