mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
net: Don't register pernet_operations if only one of id or size is specified.
We can allocate per-netns memory for struct pernet_operations by specifying id and size. register_pernet_operations() assigns an id to pernet_operations and later ops_init() allocates the specified size of memory as net->gen->ptr[id]. If id is missing, no memory is allocated. If size is not specified, pernet_operations just wastes an entry of net->gen->ptr[] for every netns. net_generic is available only when both id and size are specified, so let's ensure that. While we are at it, we add const to both fields. Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
1ad001347f
commit
768e4bb6a7
@@ -451,8 +451,8 @@ struct pernet_operations {
|
||||
/* Following method is called with RTNL held. */
|
||||
void (*exit_batch_rtnl)(struct list_head *net_exit_list,
|
||||
struct list_head *dev_kill_list);
|
||||
unsigned int *id;
|
||||
size_t size;
|
||||
unsigned int * const id;
|
||||
const size_t size;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user