Skip to content

Commit

Permalink
ihklib: ihk_reserve_mem: Fix error handling
Browse files Browse the repository at this point in the history
Change-Id: I07fe0aa20c9f0601e5def9e82238eae2ddc26198
  • Loading branch information
masamichitakagi committed Jan 31, 2020
1 parent 7891d8a commit 0ff7409
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion linux/user/ihklib.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,15 @@ int ihk_reserve_mem(int index, struct ihk_mem_chunk *mem_chunks,
CHKANDJUMP(num_mem_chunks > IHK_MAX_NUM_MEM_CHUNKS, -EINVAL,
"too many memory chunks requested\n");

CHKANDJUMP(!mem_chunks || !num_mem_chunks, -EINVAL, "invalid format\n");
if (num_mem_chunks != 0 && mem_chunks == NULL) {
ret = -EFAULT;
goto out;
}

if (num_mem_chunks == 0) {
ret = 0;
goto out;
};

req.sizes = calloc(num_mem_chunks, sizeof(size_t));
if (!req.sizes) {
Expand Down

0 comments on commit 0ff7409

Please sign in to comment.