mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-17 16:47:50 +00:00
plugin/amdgpu: Check output of open_img_file
open_img_file can return null if, for example, the dump file isn't present. Tehre were three places where this wasn't checked. Check it. Signed-off-by: David Francis <David.Francis@amd.com>
This commit is contained in:
parent
af3f4be066
commit
bd4cd4e9ee
2 changed files with 10 additions and 0 deletions
|
|
@ -1141,6 +1141,9 @@ int amdgpu_restore_init(void)
|
|||
while ((dir = readdir(d)) != NULL) {
|
||||
if (strncmp("amdgpu-kfd-", dir->d_name, strlen("amdgpu-kfd-")) == 0) {
|
||||
img_fp = open_img_file(dir->d_name, false, &img_size);
|
||||
if (!img_fp)
|
||||
return -EINVAL;
|
||||
|
||||
buf = xmalloc(img_size);
|
||||
if (!buf) {
|
||||
fclose(img_fp);
|
||||
|
|
@ -1163,6 +1166,9 @@ int amdgpu_restore_init(void)
|
|||
}
|
||||
if (strncmp("amdgpu-renderD-", dir->d_name, strlen("amdgpu-renderD-")) == 0) {
|
||||
img_fp = open_img_file(dir->d_name, false, &img_size);
|
||||
if (!img_fp)
|
||||
return -EINVAL;
|
||||
|
||||
buf = xmalloc(img_size);
|
||||
if (!buf) {
|
||||
fclose(img_fp);
|
||||
|
|
|
|||
|
|
@ -210,6 +210,10 @@ static int restore_bo_contents_drm(int drm_render_minor, CriuRenderNode *rd, int
|
|||
snprintf(img_path, sizeof(img_path), IMG_DRM_PAGES_FILE, rd->id, drm_render_minor, i);
|
||||
|
||||
bo_contents_fp = open_img_file(img_path, false, &image_size);
|
||||
if (!bo_contents_fp) {
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
ret = sdma_copy_bo(dmabufs[i], rd->bo_entries[i]->size, bo_contents_fp, buffer, buffer_size, h_dev, max_copy_size,
|
||||
SDMA_OP_VRAM_WRITE, true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue