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]
Date:	Wed, 06 Jan 2016 09:52:41 -0800
From:	Joe Perches <joe@...ches.com>
To:	Anjali Menon <cse.anjalimenon@...il.com>,
	gregkh@...uxfoundation.org
Cc:	linux-wireless@...r.kernel.org, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: wilc1000: Removed unnecessary braces

On Wed, 2016-01-06 at 18:59 +0530, Anjali Menon wrote:
> Removed unnecessary braces for single statement blocks to
> fix the warning detected by checkpatch.pl
> 
> WARNING: braces {} are not necessary for single statement blocks
> 
> Signed-off-by: Anjali Menon <cse.anjalimenon@...il.com>
> ---
>  drivers/staging/wilc1000/wilc_wlan_cfg.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c
> index a34a81c..afb5d2c 100644
> --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
> +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
> @@ -251,9 +251,8 @@ static int wilc_wlan_cfg_set_bin(u8 *frame, u32 offset, u16 id, u8 *b, u32 size)
>  
>  	if ((b != NULL) && (size != 0)) {
>  		memcpy(&buf[4], b, size);
> -		for (i = 0; i < size; i++) {
> +		for (i = 0; i < size; i++)
>  			checksum += buf[i + 4];
> -		}
>  	}
>  
>  	buf[size + 4] = checksum;

Please think of what the code is doing instead
of just shutting up checkpatch.

Maybe instead of walking the buffer twice, once
for the memcpy, another for the checksum, perhaps
using a routine to do both at the same time would
be better.

Maybe something like:

	if (b && size) {
		u32 count = size;
		u8 *to = &buf[4];

		while (count--)
			checksum += (*to++ = *b++);
	}

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