mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-25 02:58:54 +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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue