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 Jun 2014 17:28:18 -0700
From:	Joe Perches <joe@...ches.com>
To:	Anish Bhatt <anish@...lsio.com>
Cc:	linux-kernel@...r.kernel.org, akpm@...ux-foundation.org
Subject: Re: [PATCH] checkpatch: Warn on unnecessary void function return
 statements

On Mon, 2014-06-16 at 16:28 -0700, Anish Bhatt wrote:
> This seems to ignore the ability to exit from void
> return functions via a `return;` in case of an error
> or similar. Any attempt to bail out generates warnings
> with checkpathch.pl Perhaps it should check for returns
> only at the end of the function ? If not, is there a
> suggested way to do this ? goto labels can't be directly
> used in place either

The only time checkpatch should bleat any message
is when there is a return; statement indented with
a single tab.
 
This form should be fine and not generate any
checkpatch warning.

void function(void)
{
	...

	if (err)
		return;

	...

}


If you want to use exit labels, I suggest you
use this form:

void function(void)
{

	...

	if (err)
		goto exit;

	...

exit:
	;
}


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