lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=McbH7be7Y1SDO3UtSSOgYiDnHde1Au2yhsJxMcviDiJGQ@mail.gmail.com>
Date:   Wed, 8 Jan 2020 17:55:39 +0100
From:   Bartosz Golaszewski <brgl@...ev.pl>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Kent Gibson <warthog618@...il.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: Re: [PATCH v4 12/13] gpiolib: add new ioctl() for monitoring changes
 in line info

śr., 8 sty 2020 o 13:46 Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> napisał(a):
>
> On Tue, Dec 24, 2019 at 01:07:08PM +0100, Bartosz Golaszewski wrote:
> ...
>
> > -     } else if (cmd == GPIO_GET_LINEINFO_IOCTL) {
> > +     } else if (cmd == GPIO_GET_LINEINFO_IOCTL ||
> > +                cmd == GPIO_GET_LINEINFO_WATCH_IOCTL) {
>
> What about to split the functionality to something like lineinfo_get() and...
>
> >               struct gpioline_info lineinfo;
>
> > -             struct gpio_desc *desc;
>
> Hmm... Is it correct patch for this change?

Yes, because instead of declaring *desc in every branch, we declare it
once and use it twice.

>
> >
> >               if (copy_from_user(&lineinfo, ip, sizeof(lineinfo)))
> >                       return -EFAULT;
> > @@ -1246,11 +1260,25 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
> >
> >               if (copy_to_user(ip, &lineinfo, sizeof(lineinfo)))
> >                       return -EFAULT;
> > +
> > +             if (cmd == GPIO_GET_LINEINFO_WATCH_IOCTL)
> > +                     set_bit(desc_to_gpio(desc), priv->watched_lines);
> > +
>
> ...simple use
>
>         } else if (cmd == GPIO_GET_LINEINFO_IOCTL) {
>                 return lineinfo_get();
>         } else if {cmd == GPIO_GET_LINEINFO_WATCH_IOCTL) {
>                 ret = lineinfo_get()
>                 set_bit();
>                 return ret;
>         }
>
> ?

You still need to retrieve *desc outside of lineinfo_get(). I think
it's not worth the hassle.

Bart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ