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: <CANq1E4TK6am=HY+0wThLpe=bviPZfETGr=dOoQxY-Wf+F89P_Q@mail.gmail.com>
Date:	Wed, 17 Jun 2015 19:21:59 +0200
From:	David Herrmann <dh.herrmann@...il.com>
To:	Sergei Zviagintsev <sergei@...v.net>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Daniel Mack <daniel@...que.org>,
	David Herrmann <dh.herrmann@...glemail.com>,
	Djalal Harouni <tixxdz@...ndz.org>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] kdbus: kdbus_reply_find(): return on found entry

Hi

On Wed, Jun 17, 2015 at 7:14 PM, Sergei Zviagintsev <sergei@...v.net> wrote:
> Return found entry immediately instead of assigning it to additional
> variable and breaking the loop. It's simpler to read, the same way is
> used in kdbus_conn_has_name(), for example.
>
> Signed-off-by: Sergei Zviagintsev <sergei@...v.net>
> ---
>  ipc/kdbus/reply.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)

Yeah, left-over from reply->mutex.

Reviewed-by: David Herrmann <dh.herrmann@...il.com>

Thanks
David

> diff --git a/ipc/kdbus/reply.c b/ipc/kdbus/reply.c
> index 89d355b44f63..9d823ebee71f 100644
> --- a/ipc/kdbus/reply.c
> +++ b/ipc/kdbus/reply.c
> @@ -171,17 +171,15 @@ struct kdbus_reply *kdbus_reply_find(struct kdbus_conn *replying,
>                                      struct kdbus_conn *reply_dst,
>                                      u64 cookie)
>  {
> -       struct kdbus_reply *r, *reply = NULL;
> +       struct kdbus_reply *r;
>
>         list_for_each_entry(r, &reply_dst->reply_list, entry) {
>                 if (r->cookie == cookie &&
> -                   (!replying || r->reply_src == replying)) {
> -                       reply = r;
> -                       break;
> -               }
> +                   (!replying || r->reply_src == replying))
> +                       return r;
>         }
>
> -       return reply;
> +       return NULL;
>  }
>
>  /**
> --
> 1.8.3.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ