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]
Date:	Thu, 8 Oct 2015 16:34:27 +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 24/44] kdbus: Cleanup kdbus_conn_unicast()

Hi

On Thu, Oct 8, 2015 at 1:31 PM, Sergei Zviagintsev <sergei@...v.net> wrote:
> Do not initialize `name' and `ret' as values are assigned to them at
> the first use by kdbus_pin_dst(). Simplify handling of
> kdbus_conn_entry_insert() return value and drop useless goto.
>
> Signed-off-by: Sergei Zviagintsev <sergei@...v.net>
> ---
>  ipc/kdbus/connection.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/ipc/kdbus/connection.c b/ipc/kdbus/connection.c
> index db49f282a1bf..b3c5f20a57d8 100644
> --- a/ipc/kdbus/connection.c
> +++ b/ipc/kdbus/connection.c
> @@ -1229,12 +1229,12 @@ static int kdbus_conn_unicast(struct kdbus_conn *src,
>                               struct kdbus_staging *staging)
>  {
>         const struct kdbus_msg *msg = staging->msg;
> -       struct kdbus_name_entry *name = NULL;
> +       struct kdbus_name_entry *name;
>         struct kdbus_reply *wait = NULL;
>         struct kdbus_conn *dst = NULL;
>         struct kdbus_bus *bus = src->ep->bus;
>         bool is_signal = (msg->flags & KDBUS_MSG_SIGNAL);
> -       int ret = 0;
> +       int ret;
>
>         if (WARN_ON(msg->dst_id == KDBUS_DST_ID_BROADCAST) ||
>             WARN_ON(!(msg->flags & KDBUS_MSG_EXPECT_REPLY) &&
> @@ -1245,7 +1245,6 @@ static int kdbus_conn_unicast(struct kdbus_conn *src,
>         down_read(&bus->name_registry->rwlock);
>
>         /* find and pin destination */
> -

If a comment is addressed to a whole following block, we usually put a
newline after it. Only if the comment is only addressed at the next
code-line, we don't.

>         ret = kdbus_pin_dst(bus, staging, &name, &dst);
>         if (ret < 0)
>                 goto exit;
> @@ -1276,11 +1275,10 @@ static int kdbus_conn_unicast(struct kdbus_conn *src,
>                 kdbus_bus_eavesdrop(bus, src, staging);
>
>         ret = kdbus_conn_entry_insert(src, dst, staging, wait, name);
> -       if (ret < 0 && !is_signal)
> -               goto exit;
>
>         /* signals are treated like broadcasts, recv-errors are ignored */
> -       ret = 0;
> +       if (is_signal)
> +               ret = 0;

Why? Just to reduce the line-count? You break the code-flow here, by
making the success-path conditional, instead of the error-path.

Thanks
David

>
>  exit:
>         up_read(&bus->name_registry->rwlock);
> --
> 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