[PATCH 1/1] NAX LSM: Add initial support support

THOBY Simon Simon.THOBY at viveris.fr
Mon Aug 16 07:31:12 UTC 2021


Hi Igor,

On 8/13/21 10:10 PM, Igor Zhbanov wrote:
> Hi Simon,
> 
> ср, 28 июл. 2021 г. в 13:19, THOBY Simon <Simon.THOBY at viveris.fr>:
>> The kernel style guide mandates that all variables are only defined at the beggining of the
>> function, and not at the beggining of any block like C89.
> 
> I've checked the kernel coding style and couldn't find anything about
> variables definition
> place. Could you, please, point me to the requirement?

After trying (without results) to find it in the kernel coding style, it seems I have
accepted a maintainer preference as the official style guide without checking:
https://lore.kernel.org/linux-integrity/bd785a9d0c029cec34514d306e110bdef945c13e.camel@linux.ibm.com/
(see "Move the variable definition to the beginning of the function.")

I'm sorry about that, and for the time you may have lost trying to locate it in the style guide, which
doesn't say (as far as I could see) anything about variable declarations.

> 
> Scoping variables declaration makes the code better and more secure.

Not arguing, I agree with you on the benefits for maintainability and readability of
keeping variable declaration and use localized (which is also why I think
'allowed_caps_hex' would be better as a local variable).

> Besides, I've checked the kernel sources and see many examples of that.
> 
> Thank you.
> 

Sorry again,
Simon


More information about the Linux-security-module-archive mailing list