net: use get_random_u32() for net_namespace hash_mix initialization
Subsystems (2)
PATCH 1/1 net: use get_random_u32() for net_namespace hash_mix initialization
Use get_random_u32() instead of get_random_bytes() to initialize net->hash_mix. This is the preferred API for obtaining a single random u32 value, as it returns the value directly rather than writing through a pointer, and requires no size parameter.
--- net/core/net_namespace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/net_namespace.c +1 -1
@@ -411,7 +411,7 @@ static __net_init int preinit_net(struct net *net, struct user_namespace *user_nref_tracker_dir_init (&net->refcnt_tracker,128 ,"net_refcnt" );ref_tracker_dir_init (&net->notrefcnt_tracker,128 ,"net_notrefcnt" ); -get_random_bytes (&net->hash_mix,sizeof (u32)); + net->hash_mix =get_random_u32 (); net->dev_base_seq =1 ; net->user_ns = user_ns;
Signature · 1 line
2.53.0
Quoted 8 lines · David Carlier
Use
get_random_u32()instead ofget_random_bytes()to initializenet->hash_mix. This is the preferred API for obtaining a single random u32 value, as it returns the value directly rather than writing through a pointer, and requires no size parameter.Signed-off-by David Carlier <[email protected]>---
I feel a tree-wide patch could be attempted ?
Thanks.
Sure !
Quoted 14 lines · Eric Dumazet
Quoted 8 lines · David Carlier
Use
get_random_u32()instead ofget_random_bytes()to initializenet->hash_mix. This is the preferred API for obtaining a single random u32 value, as it returns the value directly rather than writing through a pointer, and requires no size parameter.Signed-off-by David Carlier <[email protected]>---
I feel a tree-wide patch could be attempted ?
Thanks.