diff options
| author | David Carlier <devnexen@gmail.com> | 2026-04-07 16:07:58 +0100 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-04-09 19:27:43 -0700 |
| commit | 9addea5d44b69d377ba97a36f7a19e1097969e18 (patch) | |
| tree | 361e94c939b7df333f29d141e26526ed7d42a5aa /drivers/net/netdevsim | |
| parent | 581d28606cdd51c5da06330e8fb97476503cd74d (diff) | |
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>
Diffstat (limited to 'drivers/net/netdevsim')
| -rw-r--r-- | drivers/net/netdevsim/psample.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/netdevsim/psample.c b/drivers/net/netdevsim/psample.c index 47d24bc64ee4..717d157c3ae2 100644 --- a/drivers/net/netdevsim/psample.c +++ b/drivers/net/netdevsim/psample.c @@ -94,7 +94,7 @@ static void nsim_dev_psample_md_prepare(const struct nsim_dev_psample *psample, if (psample->out_tc_occ_max) { u64 out_tc_occ; - get_random_bytes(&out_tc_occ, sizeof(u64)); + out_tc_occ = get_random_u64(); md->out_tc_occ = out_tc_occ & (psample->out_tc_occ_max - 1); md->out_tc_occ_valid = 1; } @@ -102,7 +102,7 @@ static void nsim_dev_psample_md_prepare(const struct nsim_dev_psample *psample, if (psample->latency_max) { u64 latency; - get_random_bytes(&latency, sizeof(u64)); + latency = get_random_u64(); md->latency = latency & (psample->latency_max - 1); md->latency_valid = 1; } |
