Skip to content

Commit

Permalink
staging: ion: simplify ioctl args checking function
Browse files Browse the repository at this point in the history
Make arguments checking more easy to read.

Signed-off-by: Benjamin Gaignard <[email protected]>
Acked-by: Laura Abbott <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Benjamin-Gaignard authored and gregkh committed Nov 2, 2017
1 parent 198277f commit fd13359
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions drivers/staging/android/ion/ion-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,18 @@ union ion_ioctl_arg {

static int validate_ioctl_arg(unsigned int cmd, union ion_ioctl_arg *arg)
{
int ret = 0;

switch (cmd) {
case ION_IOC_HEAP_QUERY:
ret = arg->query.reserved0 != 0;
ret |= arg->query.reserved1 != 0;
ret |= arg->query.reserved2 != 0;
if (arg->query.reserved0 ||
arg->query.reserved1 ||
arg->query.reserved2 )
return -EINVAL;
break;
default:
break;
}

return ret ? -EINVAL : 0;
return 0;
}

/* fix up the cases where the ioctl direction bits are incorrect */
Expand Down

0 comments on commit fd13359

Please sign in to comment.