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, 11 Jul 2018 21:17:40 +0200
From:   Michael Straube <straube.linux@...il.com>
To:     Joe Perches <joe@...ches.com>, gregkh@...uxfoundation.org
Cc:     devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/6] staging: rtl8723bs: fix indentation

On 07/11/18 18:03, Joe Perches wrote:
> On Wed, 2018-07-11 at 15:57 +0200, Michael Straube wrote:
>> On 07/08/18 19:36, Michael Straube wrote:
>>> On 07/08/18 18:46, Joe Perches wrote:
>>>> On Sun, 2018-07-08 at 12:38 +0200, Michael Straube wrote:
>>>>
>>>> uint rtw_is_cckratesonly_included(u8 *rate)
>>>> {
>>>>      while (*rate) {
>>>>          u8 r = *rate & 0x7f;
>>>>
>>>>          if (r != 2 && r != 4 && r != 11 && r != 22)
>>>>              return false;
>>>>          rate++;
>>>>      }
>>>>
>>>>      return true;
>>>> }
>>>>
>>>
>>> The patch has been added to staging-testing already.
>>> I will send patches with your suggestions the next days.
>>
>> Would it be preferred to declare the variable at the functions beginning,
>> or doesn't it matter regarding coding style?
> 
> Not really.
> 
> It's generally preferred to have declarations in the
> nearest possible open brace to allow the compiler to
> reduce the overall stack space consumed by the function.
> 
> For example prefer:
> 
> int some_function(int arg, void *pointer)
> {
> 	if (arg == 1} {
> 		struct foo a = *(struct foo *)pointer;
> 		...
> 	} else if (arg == 2) {
> 		struct bar b = *(struct bar *)pointer;
> 		...
> 	}
> }
> 
> over
> 
> int some_function(int arg, void *pointer)
> {
> 	struct foo a;
> 	s
> truct bar b;
> 
> 	if (arg == 1} {
> 		a = *(struct foo *)pointer;
> 		...
> 	} else if (arg == 2) {
> 		b = *(struct bar *)pointer;
> 		...
> 	}
> }
> 
> as a and b could use the same stack in the
> first example but not the second.
> 

Ok, thanks for explaining.
Michael

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ