mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
net: use get_random_u{16,32,64}() where appropriate
Use the typed random integer helpers instead of get_random_bytes() when filling a single integer variable. The helpers return the value directly, require no pointer or size argument, and better express intent. Skipped sites writing into __be16 (netdevsim) and __le64 (ceph) fields where a direct assignment would trigger sparse endianness warnings. Signed-off-by: David Carlier <devnexen@gmail.com> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20260407150758.5889-1-devnexen@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
581d28606c
commit
9addea5d44
@@ -1275,7 +1275,7 @@ void tipc_node_check_dest(struct net *net, u32 addr,
|
||||
goto exit;
|
||||
|
||||
if_name = strchr(b->name, ':') + 1;
|
||||
get_random_bytes(&session, sizeof(u16));
|
||||
session = get_random_u16();
|
||||
if (!tipc_link_create(net, if_name, b->identity, b->tolerance,
|
||||
b->net_plane, b->mtu, b->priority,
|
||||
b->min_win, b->max_win, session,
|
||||
|
||||
Reference in New Issue
Block a user