linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laura Abbott <labbott@redhat.com>
To: "Benjamin Gaignard" <benjamin.gaignard@linaro.org>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Riley Andrews" <riandrews@android.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Dan Carpenter" <dan.carpenter@oracle.com>
Cc: driverdevel <devel@driverdev.osuosl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	linux-api@vger.kernel.org
Subject: Re: [PATCH v5 1/2] staging: ion: simplify ioctl args checking function
Date: Mon, 9 Oct 2017 09:45:01 -0700	[thread overview]
Message-ID: <21cdb12c-efe5-a7f5-3939-01fa9ff20b56@redhat.com> (raw)
In-Reply-To: <CA+M3ks6XGmgxeDf89CFAP2sxtR8Tksend7bZz1o9EkDkxeyxNg@mail.gmail.com>

On 10/09/2017 02:21 AM, Benjamin Gaignard wrote:
> 2017-09-27 15:20 GMT+02:00 Benjamin Gaignard <benjamin.gaignard@linaro.org>:
>> Make arguments checking more easy to read.
>>
> 
> Hi Laura,
> 
> Even if we don't have found a solution for the second patch I believe
> this one could be useful.
> May I ask you your point of view on those few lines ?
> 
> Benjamin
> 

Yes, this looks better.

Acked-by: Laura Abbott <labbott@redhat.com>

>> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
>> ---
>>  drivers/staging/android/ion/ion-ioctl.c | 11 +++++------
>>  1 file changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/staging/android/ion/ion-ioctl.c b/drivers/staging/android/ion/ion-ioctl.c
>> index d9f8b14..e26b786 100644
>> --- a/drivers/staging/android/ion/ion-ioctl.c
>> +++ b/drivers/staging/android/ion/ion-ioctl.c
>> @@ -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 */
>> --
>> 2.7.4
>>
> 
> 
> 

  reply	other threads:[~2017-10-09 16:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-27 13:20 [PATCH v5 0/2] staging: ion: get one device per heap Benjamin Gaignard
2017-09-27 13:20 ` [PATCH v5 1/2] staging: ion: simplify ioctl args checking function Benjamin Gaignard
2017-10-09  9:21   ` Benjamin Gaignard
2017-10-09 16:45     ` Laura Abbott [this message]
2017-09-27 13:20 ` [PATCH v5 2/2] staging: ion: create one device entry per heap Benjamin Gaignard
     [not found]   ` <1506518409-16887-3-git-send-email-benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-10-02 18:07     ` Laura Abbott
2017-10-03 16:48       ` Mark Brown
2017-10-03 21:42         ` Laura Abbott
     [not found]           ` <2417c969-357f-d5d9-153a-2180d09b0dc6-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-10-03 23:08             ` Sandeep Patil
     [not found]               ` <20171003230830.GA132839-MgWQydg8T0mvj1b/ULB3ZwqCisvMvsWYTsK6IJ4gZTFBDgjK7y7TUQ@public.gmane.org>
2017-10-03 23:37                 ` Laura Abbott
2017-10-04 10:17                 ` Mark Brown
2017-10-05 13:06                   ` Benjamin Gaignard
2017-10-09 21:25                     ` Laura Abbott
2017-10-09 22:08                       ` Mark Brown
2017-10-10  0:10                         ` Laura Abbott
2017-10-10  9:11                           ` Mark Brown
2017-10-16 22:09                             ` Laura Abbott
     [not found]                               ` <2a9246e0-eafa-7812-6cf4-2482ff1ed158-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-10-17 12:39                                 ` Benjamin Gaignard
2017-10-18 20:07   ` Laura Abbott
     [not found]     ` <bff3d0c7-110d-d702-165b-855daaca6382-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-10-23 15:19       ` Benjamin Gaignard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=21cdb12c-efe5-a7f5-3939-01fa9ff20b56@redhat.com \
    --to=labbott@redhat.com \
    --cc=arve@android.com \
    --cc=benjamin.gaignard@linaro.org \
    --cc=broonie@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riandrews@android.com \
    --cc=sumit.semwal@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).