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=Md4PmbcGAKxP1LG08bREtWCtsXbt=ZgL50PrizF4F4pxg@mail.gmail.com>
Date:   Tue, 10 Dec 2019 15:11:12 +0100
From:   Bartosz Golaszewski <brgl@...ev.pl>
To:     Kent Gibson <warthog618@...il.com>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Bamvor Jian Zhang <bamv2005@...il.com>
Subject: Re: [PATCH] gpio: gpio-mockup: Fix usage of new GPIO_LINE_DIRECTION

wt., 10 gru 2019 o 03:15 Kent Gibson <warthog618@...il.com> napisaƂ(a):
>
> Restore the external behavior of gpio-mockup to what it was prior to the
> change to using GPIO_LINE_DIRECTION.
>
> Signed-off-by: Kent Gibson <warthog618@...il.com>
> ---
>
> Fix a regression introduced in v5.5-rc1.
>
> The change to GPIO_LINE_DIRECTION reversed the polarity of the
> dir field within gpio-mockup.c, but overlooked inverting the value on
> initialization and when returned by gpio_mockup_get_direction.
> The latter is a bug.
> The former is a problem for tests which assume initial conditions,
> specifically the mockup used to initialize chips with all lines as inputs.
> That superficially appeared to be the case after the previous patch due
> to the bug in gpio_mockup_get_direction.
>
>  drivers/gpio/gpio-mockup.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
> index 56d647a30e3e..c4fdc192ea4e 100644
> --- a/drivers/gpio/gpio-mockup.c
> +++ b/drivers/gpio/gpio-mockup.c
> @@ -226,7 +226,7 @@ static int gpio_mockup_get_direction(struct gpio_chip *gc, unsigned int offset)
>         int direction;
>
>         mutex_lock(&chip->lock);
> -       direction = !chip->lines[offset].dir;
> +       direction = chip->lines[offset].dir;
>         mutex_unlock(&chip->lock);
>
>         return direction;
> @@ -395,7 +395,7 @@ static int gpio_mockup_probe(struct platform_device *pdev)
>         struct gpio_chip *gc;
>         struct device *dev;
>         const char *name;
> -       int rv, base;
> +       int rv, base, i;
>         u16 ngpio;
>
>         dev = &pdev->dev;
> @@ -447,6 +447,9 @@ static int gpio_mockup_probe(struct platform_device *pdev)
>         if (!chip->lines)
>                 return -ENOMEM;
>
> +       for (i = 0; i < gc->ngpio; i++)
> +               chip->lines[i].dir = GPIO_LINE_DIRECTION_IN;
> +
>         if (device_property_read_bool(dev, "named-gpio-lines")) {
>                 rv = gpio_mockup_name_lines(dev, chip);
>                 if (rv)
> --
> 2.24.0
>

Hi Kent,

I was applying and testing your libgpiod series and noticed that the
gpio-tools tests fail after applying patches 16 & 17 (with linux
v5.5-rc1). Is this fix related to this?

Bart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ