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] [day] [month] [year] [list]
Message-ID: <20140827100430.GF5046@mwanda>
Date:	Wed, 27 Aug 2014 13:04:30 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	"K. Y. Srinivasan" <kys@...rosoft.com>
Cc:	gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
	devel@...uxdriverproject.org, olaf@...fle.de, apw@...onical.com,
	jasowang@...hat.com, sitsofe@...il.com, stable@...r.kernel.org
Subject: Re: [PATCH 3/4] Drivers: hv: vmbus: Cleanup vmbus_close_internal()

On Tue, Aug 26, 2014 at 12:05:51PM -0700, K. Y. Srinivasan wrote:
> -static void vmbus_close_internal(struct vmbus_channel *channel)
> +static int vmbus_close_internal(struct vmbus_channel *channel)
>  {
>  	struct vmbus_channel_close_channel *msg;
> -	int ret;
> +	int ret = 0;

GCC has a feature which warns about uninitialized variables.  Those
features are there to help prevent bugs.  You are turning the feature
off here by initializing it with a bogus value.  Don't do that.

>  
>  	channel->state = CHANNEL_OPEN_STATE;
>  	channel->sc_creation_callback = NULL;
> @@ -502,11 +502,28 @@ static void vmbus_close_internal(struct vmbus_channel *channel)
>  
>  	ret = vmbus_post_msg(msg, sizeof(struct vmbus_channel_close_channel));
>  
> -	BUG_ON(ret != 0);
> +	if (ret) {
> +		pr_err("Close failed: close post msg return is %d\n", ret);
> +		/*
> +		 * If we failed to post the close msg,
> +		 * it is perhaps better to leak memory.
> +		 */
> +		goto close_err;


Just return directly.  Don't introduce do-nothing gotos to lead the
reader through a series of pointless goto hops.

The goto label is poorly chosen.  Label names should be based on the
thing which they do.  "close_err" implies that something is closed but
that's not the case, the label doesn't do anything.

regards,
dan carpenter

--
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