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: <CAMuHMdXuh4gUSoZxJpp-KYJQHTOzn9Cey04MM9C6n6a-B5CR2Q@mail.gmail.com>
Date:   Fri, 13 Jan 2017 19:16:56 +0100
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc:     linux-spi <linux-spi@...r.kernel.org>,
        Mark Brown <broonie@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH 17/17] spi/topcliff-pch: One check less in pch_spi_set_tx()

Hi Markus,

On Fri, Jan 13, 2017 at 6:28 PM, SF Markus Elfring
<elfring@...rs.sourceforge.net> wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Fri, 13 Jan 2017 17:30:46 +0100
>
> Delete a duplicate check after a bit of exception handling was moved into
> a previous if branch of this function.

This is not equivalent: if data->pkt_tx_buff == NULL, the queue is no longer
flushed.

> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
>  drivers/spi/spi-topcliff-pch.c | 25 ++++++++++++++-----------
>  1 file changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
> index 97fd1ea9826b..33043a830032 100644
> --- a/drivers/spi/spi-topcliff-pch.c
> +++ b/drivers/spi/spi-topcliff-pch.c
> @@ -584,22 +584,25 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw)
>         data->pkt_tx_buff = kzalloc(size, GFP_KERNEL);
>         if (data->pkt_tx_buff) {
>                 data->pkt_rx_buff = kzalloc(size, GFP_KERNEL);
> -               if (!data->pkt_rx_buff)
> +               if (!data->pkt_rx_buff) {
>                         kfree(data->pkt_tx_buff);
> -       }
>
> -       if (!data->pkt_rx_buff) {
> -               /* flush queue and set status of all transfers to -ENOMEM */
> -               list_for_each_entry_safe(pmsg, tmp, data->queue.next, queue) {
> -                       pmsg->status = -ENOMEM;
> +                       /*
> +                        * Flush queue and set status of all transfers
> +                        * to -ENOMEM.
> +                        */
> +                       list_for_each_entry_safe(pmsg, tmp, data->queue.next,
> +                                                queue) {
> +                               pmsg->status = -ENOMEM;
>
> -                       if (pmsg->complete)
> -                               pmsg->complete(pmsg->context);
> +                               if (pmsg->complete)
> +                                       pmsg->complete(pmsg->context);
>
> -                       /* delete from queue */
> -                       list_del_init(&pmsg->queue);
> +                               /* delete from queue */
> +                               list_del_init(&pmsg->queue);
> +                       }
> +                       return;
>                 }
> -               return;
>         }
>
>         /* copy Tx Data */




-- 
Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ