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:	Sun, 23 Mar 2014 10:45:09 -0700
From:	Joe Perches <joe@...ches.com>
To:	Jake Edge <jake@...e2.net>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Jade Bilkey <herself@...fumon.com>, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] staging: fix bcm/hostmibs.c checkpatch problems

On Sat, 2014-03-22 at 09:50 -0600, Jake Edge wrote:
> Fix 4 checkpatch errors, many warnings in bcm/hostmibs.c

Making code checkpatch clean shouldn't be the primary goal here.

Removing uses of Hungarian-style notation, CamelCase naming, and
long variable names would be more helpful overall.

> diff --git a/drivers/staging/bcm/hostmibs.c b/drivers/staging/bcm/hostmibs.c
[]
> @@ -9,27 +9,32 @@
[]
> -INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter, struct bcm_host_stats_mibs *pstHostMibs)
> +INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter,
> +		       struct bcm_host_stats_mibs *pstHostMibs)
[]
> -	struct bcm_phs_extension *pDeviceExtension = (struct bcm_phs_extension *) &Adapter->stBCMPhsContext;
> +	struct bcm_phs_extension *pDeviceExtension =
> +			(struct bcm_phs_extension *) &Adapter->stBCMPhsContext;

btw: this cast is  unnecessary.
&Adapter->stBCMPhsContext is a (struct bcm_phs_extension *)
 
> -	UINT nClassifierIndex = 0, nPhsTableIndex = 0, nSfIndex = 0, uiIndex = 0;
> +	UINT nClassifierIndex = 0, nPhsTableIndex = 0,
> +						nSfIndex = 0, uiIndex = 0;

Using one initializer per line is generally better.
 
[]

> 	/* Copy the classifier Table */
> -	for (nClassifierIndex = 0; nClassifierIndex < MAX_CLASSIFIERS; nClassifierIndex++) {
> +	for (nClassifierIndex = 0; nClassifierIndex < MAX_CLASSIFIERS;
> +							nClassifierIndex++) {
>  		if (Adapter->astClassifierTable[nClassifierIndex].bUsed == TRUE)
> -			memcpy((PVOID) &pstHostMibs->
> +			memcpy((PVOID)&pstHostMibs->
>  			       astClassifierTable[nClassifierIndex],
> -			       (PVOID) &Adapter->
> +			       (PVOID)&Adapter->
>  			       astClassifierTable[nClassifierIndex],
>  			       sizeof(struct bcm_mibs_classifier_rule));

You could remove the (PVOID) casts here.
mem<foo> pointers don't need to be cast to void,
the compiler already does that.

> @@ -82,53 +88,70 @@ INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter, struct bcm_host_stats_m
>  	/* Copy other Host Statistics parameters */
>  	pstHostMibs->stHostInfo.GoodTransmits = Adapter->dev->stats.tx_packets;
>  	pstHostMibs->stHostInfo.GoodReceives = Adapter->dev->stats.rx_packets;
> -	pstHostMibs->stHostInfo.CurrNumFreeDesc = atomic_read(&Adapter->CurrNumFreeTxDesc);
> +	pstHostMibs->stHostInfo.CurrNumFreeDesc =
> +				atomic_read(&Adapter->CurrNumFreeTxDesc);
>  	pstHostMibs->stHostInfo.BEBucketSize = Adapter->BEBucketSize;
>  	pstHostMibs->stHostInfo.rtPSBucketSize = Adapter->rtPSBucketSize;
>  	pstHostMibs->stHostInfo.TimerActive = Adapter->TimerActive;
>  	pstHostMibs->stHostInfo.u32TotalDSD = Adapter->u32TotalDSD;

maybe use a temporary for &pst->stHostInfo and change all
of these to

	host_info-><foo> = Adapter-><bar>;


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