Thread (4 messages) flat view 4 messages, 2 authors, 2021-01-07

Re: [PATCH net-next] net: sysctl: cleanup net_sysctl_init()

From: Alexander Lobakin <hidden>
Date: 2021-01-07 09:14:35
Also in: lkml

From: Jakub Kicinski <kuba@kernel.org>
Date: Wed, 6 Jan 2021 16:30:56 -0800
On Wed, 06 Jan 2021 20:40:28 +0000 Alexander Lobakin wrote:
quoted
'net_header' is not used outside of this function, so can be moved
from BSS onto the stack.
Declarations of one-element arrays are discouraged, and there's no
need to store 'empty' in BSS. Simply allocate it from heap at init.
Are you sure? It's passed as an argument to register_sysctl()
so it may well need to be valid for the lifetime of net_header.
I just moved it from BSS to the heap and allocate it using kzalloc(),
it's still valid through the lifetime of the kernel.

Al
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help