libion: Add missing error checks for input parameters to APIs.

The errors were caught by ion-unit-tests. Make sure we fix them before
we start running the tests in automation etc.

Bug: 133508579
Test: ion-unit-tests

Change-Id: I7ebecfa037767481ee7f2b30e2923c84ebc352bf
Signed-off-by: Sandeep Patil <sspatil@google.com>
This commit is contained in:
Sandeep Patil 2019-07-15 17:29:33 -07:00
parent 21620dc745
commit 89ea28116a
1 changed files with 3 additions and 0 deletions

View File

@ -152,6 +152,8 @@ int ion_alloc_fd(int fd, size_t len, size_t align, unsigned int heap_mask, unsig
ion_user_handle_t handle;
int ret;
if (!handle_fd) return -EINVAL;
if (!ion_is_legacy(fd)) {
struct ion_new_allocation_data data = {
.len = len,
@ -201,6 +203,7 @@ int ion_query_heap_cnt(int fd, int* cnt) {
int ret;
struct ion_heap_query query;
if (!cnt) return -EINVAL;
memset(&query, 0, sizeof(query));
ret = ion_ioctl(fd, ION_IOC_HEAP_QUERY, &query);