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:	Wed, 10 Mar 2010 19:28:10 -0800
From:	Joe Perches <joe@...ches.com>
To:	André Silva <andre.beat@...il.com>
Cc:	gregkh@...e.de, linville@...driver.com, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Staging: arlan: fixed coding style issues in
 arlan-proc.c This is a patch to the arlan-proc.c file that fixes up
 multiple coding style errors and warnings found by the checkpatch.pl tool
 Signed-off-by: Andre Silva <andre.beat@...il.com>

On Thu, 2010-03-11 at 02:58 +0000, André Silva wrote:
> From: Andre Silva <andre.beat@...il.com>

Hi Andre.

When you send a patch, please use a shorter subject
and add some commentary in the body of the email
that describes the changes before the patch itself.

> ---
>  drivers/staging/arlan/arlan-proc.c |  623 ++++++++++++++++++------------------
>  1 files changed, 306 insertions(+), 317 deletions(-)
> 
> diff --git a/drivers/staging/arlan/arlan-proc.c b/drivers/staging/arlan/arlan-proc.c
> index b22983e..62cd1d0 100644
> --- a/drivers/staging/arlan/arlan-proc.c
> +++ b/drivers/staging/arlan/arlan-proc.c
> @@ -9,48 +9,55 @@ 

What you did here 

From:
#define ARLAN_STR_SIZE 	0x2ff0
#define DEV_ARLAN_INFO 	1
#define DEV_ARLAN 	1

to:
#define ARLAN_STR_SIZE 0x2ff0
#define DEV_ARLAN_INFO 1
#define DEV_ARLAN 1

isn't an improvement.  A lot of code in the kernel uses:

#define NAME		value

using tabs so name is in one column, value another.

> +#define SARLG(type, var) {\
> +	pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x%x\n", #var,\
> +		READSHMB(priva->card->var));\
>  	}

This macro isn't nice:

It could be better as:

#define SARLG(type, var)					\
do {								\
	pos += sprintf(arlan_drive_info + pos, "%s\t=\t0x%x\n",	\
		       #var, READSHMG(priva->card->var));	\
} while (0)

or even more simpler:

#define SARLG(type, var)					\
	pos += sprintf(arlan_drive_info + pos, "%s\t=\t0x%x\n",	\
		       #var, READSHMG(priva->card->var))	\

And this:

> +#define SARLBN(type, var, nn) {\
> +	pos += sprintf(arlan_drive_info+pos, "%s\t=\t0x", #var);\
> +	for (i = 0; i < nn; i++)\
> +		pos += sprintf(arlan_drive_info+pos, "%02x",\
> +			READSHMB(priva->card->var[i]));\
> +		pos += sprintf(arlan_drive_info+pos, "\n");\
>  	}

This change is poor as you've made it seem that the last
two sprintfs are in the loop.  Only one is.

I suggest something like:

#define SARLBN(type, var, nn)					\
do {								\
	SARLG(type, var);					\
	for (i = 0; i < nn; i++)				\
		pos += sprintf(arlan_drive_info + pos, "%02x",	\
			       READSHMB(priva->card->var[i]));	\
	pos += sprintf(arlan_drive_info+pos, "\n");		\
}

Another thing you might do is get not use pos as an int,
but instead declare it as a char * starting at arlan_drive_info
so that the macros become:

	pos += sprintf(pos, fmt, args)

cheers, Joe

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