summaryrefslogtreecommitdiff
path: root/drivers/net/netdevsim/psample.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/netdevsim/psample.c')
-rw-r--r--drivers/net/netdevsim/psample.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/netdevsim/psample.c b/drivers/net/netdevsim/psample.c
index f0c6477dd0ae..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;
}
@@ -200,7 +200,7 @@ int nsim_dev_psample_init(struct nsim_dev *nsim_dev)
struct nsim_dev_psample *psample;
int err;
- psample = kzalloc(sizeof(*psample), GFP_KERNEL);
+ psample = kzalloc_obj(*psample);
if (!psample)
return -ENOMEM;
nsim_dev->psample = psample;