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:	Mon, 16 Dec 2013 13:33:18 -0000
From:	"David Laight" <David.Laight@...LAB.COM>
To:	"Wang Weidong" <wangweidong1@...wei.com>, <jon.maloy@...csson.com>,
	<allan.stephens@...driver.com>, <davem@...emloft.net>
Cc:	<erik.hugne@...csson.com>, <maloy@...jonn.com>,
	<netdev@...r.kernel.org>
Subject: RE: [PATCH net-next 1/4] tipc: remove unnecessary variables and conditions

> From: Wang Weidong
> Sent: 16 December 2013 12:40
> We remove a number of unnecessary variables and branches
> in TIPC. This patch is cosmetic and does not change the
> operation of TIPC in any way.
> 
...
>  int __tipc_disconnect(struct tipc_port *tp_ptr)
>  {
> -	int res;
> -
>  	if (tp_ptr->connected) {
>  		tp_ptr->connected = 0;
>  		/* let timer expire on it's own to avoid deadlock! */
>  		tipc_nodesub_unsubscribe(&tp_ptr->subscription);
> -		res = 0;
> -	} else {
> -		res = -ENOTCONN;
> +		return 0;
>  	}
> -	return res;
> +
> +	return -ENOTCONN;
>  }

IMHO better coded as:

	if (!tp_ptr->connected)
		return -ENOTCON;

	tp_ptr->connected = 0;
	/* let timer expire on it's own to avoid deadlock! */
	tipc_nodesub_unsubscribe(&tp_ptr->subscription);
	return 0;

	David

	


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ