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: <20170119000330.GA12052@parts.user-mode-linux.org>
Date:   Wed, 18 Jan 2017 19:03:30 -0500
From:   Jeff Dike <jdike@...toit.com>
To:     SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc:     user-mode-linux-devel@...ts.sourceforge.net,
        user-mode-linux-user@...ts.sourceforge.net,
        Anton Ivanov <aivanov@...-begemot.co.uk>,
        Dan Williams <dan.j.williams@...el.com>,
        Hannes Reinecke <hare@...e.com>, Jens Axboe <axboe@...com>,
        Richard Weinberger <richard@....at>,
        LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 1/5] um: port: Move an assignment for the variable "fd"
 in port_wait()

On Wed, Jan 18, 2017 at 10:56:17PM +0100, SF Markus Elfring wrote:
> diff --git a/arch/um/drivers/port_kern.c b/arch/um/drivers/port_kern.c
> index 40ca5cc275e9..b2bbda21c5f3 100644
> --- a/arch/um/drivers/port_kern.c
> +++ b/arch/um/drivers/port_kern.c
> @@ -230,10 +230,10 @@ int port_wait(void *data)
>  
>  	atomic_inc(&port->wait_count);
>  	while (1) {
> -		fd = -ERESTARTSYS;
> -		if (wait_for_completion_interruptible(&port->done))
> +		if (wait_for_completion_interruptible(&port->done)) {
> +			fd = -ERESTARTSYS;
>  			goto out;
> -
> +		}
>  		spin_lock(&port->lock);
>  
>  		conn = list_entry(port->connections.next, struct connection,
> -- 
> 2.11.0
>

The current code is pretty standard kernel coding style.  The inline
    fd = -ERESTARTSYS;
is likely free, or close to it, and I believe that having anything
besides a goto inside the if could make it significantly more
expensive.

				Jeff

-- 
Jeff Dike
AddToIt
978-254-0789 (o)
978-394-8986 (c)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ