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:	Sat, 26 Jan 2013 23:35:12 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	Jake Champlin <jake.champlin.27@...il.com>
Cc:	gregkh@...uxfoundation.org, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Staging: csr: csr_msgconv: Fixed Multiple Coding Style
 Issues

On Sat, Jan 26, 2013 at 03:14:35PM -0500, Jake Champlin wrote:
> Resolved 150 Style Errors and 202 Coding Style Warnings.
> 

Normally we would prefer that these are broken up into a several
different patches that each fix one type of style issue.

[patch 1/x] csr: csr_msgconv: use tab indents
[patch 2/x] csr: csr_msgconv: put curly braces on the right line
etc...

> +	CsrMsgConvPrimEntry *ptr = NULL;
> +
> +	if (converter) {
> +		ptr = converter->profile_converters;
> +	while (ptr) {
> +		if (ptr->primType == primType)
> +			break;
> +		else
> +			ptr = ptr->next;
> +	}
> +	}

The while loop should be indented one more time.

> +	if (ptr) {
> +		const CsrMsgConvMsgEntry *cv;
> +		u16 msgId = 0;
> +		size_t offset = 0;
> +		CsrUint16Des(&msgId, data, &offset);
> +
> +		cv = find_msg_converter(ptr, msgId);
> +		if (cv)
> +			ret = cv->deserFunc(data, length);
> +		else
> +			ret = NULL;
> +	} else
> +		ret = NULL;
> +

It should be:

+
+			ret = NULL;
+	} else {
+		ret = NULL;
+	}

The rules on braces are a little bit complicated.  If it's one line
then don't use braces.  If it's two lines and you don't *need* to
use braces then still use braces.

	if (foo) {
		/* some comment */
		frob();
	}

If either side of the if else statement uses braces then use braces
on both.

> +	if (ptr) {
> +		const CsrMsgConvMsgEntry *cv;
> +		u16 msgId = *(u16 *) data;
> +
> +		cv = find_msg_converter(ptr, msgId);
> +	if (cv) {
> +		cv->freeFunc(data);
> +		ret = TRUE;
> +	} else
> +		ret = FALSE;
> +	} else
> +		ret = FALSE;
> +

??

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