Skip to content

Commit

Permalink
ion: Handle heap query errors properly
Browse files Browse the repository at this point in the history
Signed-off-by: Danny Lin <[email protected]>
  • Loading branch information
kdrag0n committed Jul 21, 2021
1 parent c02db77 commit 7146700
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/staging/android/ion/ion.c
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ static long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
} data;
size_t output_size;
void *output;
int ret = 0;
int ret;
int fd;

if (_IOC_SIZE(cmd) > sizeof(data))
Expand All @@ -650,6 +650,9 @@ static long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
break;
case ION_IOC_HEAP_QUERY:
ret = ion_query_heaps(&data.query);
if (ret)
return ret;

output = &data.query;
output_size = sizeof(data.query);
break;
Expand All @@ -670,7 +673,7 @@ static long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
if (copy_to_user((void __user *)arg, output, output_size))
return -EFAULT;

return ret;
return 0;
}

struct ion_device *ion_device_create(void)
Expand Down

0 comments on commit 7146700

Please sign in to comment.