diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/802/garp.c | 2 | ||||
-rw-r--r-- | net/802/mrp.c | 2 | ||||
-rw-r--r-- | net/core/neighbour.c | 5 | ||||
-rw-r--r-- | net/core/stream.c | 2 | ||||
-rw-r--r-- | net/ipv4/devinet.c | 2 | ||||
-rw-r--r-- | net/ipv4/igmp.c | 6 | ||||
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 2 | ||||
-rw-r--r-- | net/ipv4/udp.c | 2 | ||||
-rw-r--r-- | net/ipv6/addrconf.c | 4 | ||||
-rw-r--r-- | net/ipv6/ip6_flowlabel.c | 2 | ||||
-rw-r--r-- | net/ipv6/mcast.c | 10 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_conn.c | 2 | ||||
-rw-r--r-- | net/netfilter/xt_statistic.c | 2 | ||||
-rw-r--r-- | net/openvswitch/actions.c | 2 | ||||
-rw-r--r-- | net/rds/bind.c | 2 | ||||
-rw-r--r-- | net/sched/act_gact.c | 2 | ||||
-rw-r--r-- | net/sched/sch_fq_codel.c | 2 | ||||
-rw-r--r-- | net/sched/sch_hhf.c | 2 | ||||
-rw-r--r-- | net/sched/sch_netem.c | 19 | ||||
-rw-r--r-- | net/sched/sch_pie.c | 2 | ||||
-rw-r--r-- | net/sched/sch_sfb.c | 4 | ||||
-rw-r--r-- | net/sched/sch_sfq.c | 6 | ||||
-rw-r--r-- | net/sctp/socket.c | 2 | ||||
-rw-r--r-- | net/sunrpc/cache.c | 2 | ||||
-rw-r--r-- | net/sunrpc/xprt.c | 2 | ||||
-rw-r--r-- | net/sunrpc/xprtsock.c | 2 | ||||
-rw-r--r-- | net/xfrm/xfrm_state.c | 2 |
27 files changed, 48 insertions, 46 deletions
diff --git a/net/802/garp.c b/net/802/garp.c index 5d9630a0eb93..b38ee6dcba45 100644 --- a/net/802/garp.c +++ b/net/802/garp.c | |||
@@ -397,7 +397,7 @@ static void garp_join_timer_arm(struct garp_applicant *app) | |||
397 | { | 397 | { |
398 | unsigned long delay; | 398 | unsigned long delay; |
399 | 399 | ||
400 | delay = (u64)msecs_to_jiffies(garp_join_time) * net_random() >> 32; | 400 | delay = (u64)msecs_to_jiffies(garp_join_time) * prandom_u32() >> 32; |
401 | mod_timer(&app->join_timer, jiffies + delay); | 401 | mod_timer(&app->join_timer, jiffies + delay); |
402 | } | 402 | } |
403 | 403 | ||
diff --git a/net/802/mrp.c b/net/802/mrp.c index 3ed616215870..72db2785ef2c 100644 --- a/net/802/mrp.c +++ b/net/802/mrp.c | |||
@@ -583,7 +583,7 @@ static void mrp_join_timer_arm(struct mrp_applicant *app) | |||
583 | { | 583 | { |
584 | unsigned long delay; | 584 | unsigned long delay; |
585 | 585 | ||
586 | delay = (u64)msecs_to_jiffies(mrp_join_time) * net_random() >> 32; | 586 | delay = (u64)msecs_to_jiffies(mrp_join_time) * prandom_u32() >> 32; |
587 | mod_timer(&app->join_timer, jiffies + delay); | 587 | mod_timer(&app->join_timer, jiffies + delay); |
588 | } | 588 | } |
589 | 589 | ||
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index ea97361f0e9b..e360d9e65c04 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -117,7 +117,7 @@ static void neigh_cleanup_and_release(struct neighbour *neigh) | |||
117 | 117 | ||
118 | unsigned long neigh_rand_reach_time(unsigned long base) | 118 | unsigned long neigh_rand_reach_time(unsigned long base) |
119 | { | 119 | { |
120 | return base ? (net_random() % base) + (base >> 1) : 0; | 120 | return base ? (prandom_u32() % base) + (base >> 1) : 0; |
121 | } | 121 | } |
122 | EXPORT_SYMBOL(neigh_rand_reach_time); | 122 | EXPORT_SYMBOL(neigh_rand_reach_time); |
123 | 123 | ||
@@ -1415,7 +1415,8 @@ void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, | |||
1415 | struct sk_buff *skb) | 1415 | struct sk_buff *skb) |
1416 | { | 1416 | { |
1417 | unsigned long now = jiffies; | 1417 | unsigned long now = jiffies; |
1418 | unsigned long sched_next = now + (net_random() % | 1418 | |
1419 | unsigned long sched_next = now + (prandom_u32() % | ||
1419 | NEIGH_VAR(p, PROXY_DELAY)); | 1420 | NEIGH_VAR(p, PROXY_DELAY)); |
1420 | 1421 | ||
1421 | if (tbl->proxy_queue.qlen > NEIGH_VAR(p, PROXY_QLEN)) { | 1422 | if (tbl->proxy_queue.qlen > NEIGH_VAR(p, PROXY_QLEN)) { |
diff --git a/net/core/stream.c b/net/core/stream.c index 512f0a24269b..301c05f26060 100644 --- a/net/core/stream.c +++ b/net/core/stream.c | |||
@@ -122,7 +122,7 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p) | |||
122 | DEFINE_WAIT(wait); | 122 | DEFINE_WAIT(wait); |
123 | 123 | ||
124 | if (sk_stream_memory_free(sk)) | 124 | if (sk_stream_memory_free(sk)) |
125 | current_timeo = vm_wait = (net_random() % (HZ / 5)) + 2; | 125 | current_timeo = vm_wait = (prandom_u32() % (HZ / 5)) + 2; |
126 | 126 | ||
127 | while (1) { | 127 | while (1) { |
128 | set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); | 128 | set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 9809f7b69728..646023bd5449 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -464,7 +464,7 @@ static int __inet_insert_ifa(struct in_ifaddr *ifa, struct nlmsghdr *nlh, | |||
464 | } | 464 | } |
465 | 465 | ||
466 | if (!(ifa->ifa_flags & IFA_F_SECONDARY)) { | 466 | if (!(ifa->ifa_flags & IFA_F_SECONDARY)) { |
467 | net_srandom(ifa->ifa_local); | 467 | prandom_seed((__force u32) ifa->ifa_local); |
468 | ifap = last_primary; | 468 | ifap = last_primary; |
469 | } | 469 | } |
470 | 470 | ||
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index bcbf33e58324..97e4d1655d26 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -211,7 +211,7 @@ static void igmp_stop_timer(struct ip_mc_list *im) | |||
211 | /* It must be called with locked im->lock */ | 211 | /* It must be called with locked im->lock */ |
212 | static void igmp_start_timer(struct ip_mc_list *im, int max_delay) | 212 | static void igmp_start_timer(struct ip_mc_list *im, int max_delay) |
213 | { | 213 | { |
214 | int tv = net_random() % max_delay; | 214 | int tv = prandom_u32() % max_delay; |
215 | 215 | ||
216 | im->tm_running = 1; | 216 | im->tm_running = 1; |
217 | if (!mod_timer(&im->timer, jiffies+tv+2)) | 217 | if (!mod_timer(&im->timer, jiffies+tv+2)) |
@@ -220,7 +220,7 @@ static void igmp_start_timer(struct ip_mc_list *im, int max_delay) | |||
220 | 220 | ||
221 | static void igmp_gq_start_timer(struct in_device *in_dev) | 221 | static void igmp_gq_start_timer(struct in_device *in_dev) |
222 | { | 222 | { |
223 | int tv = net_random() % in_dev->mr_maxdelay; | 223 | int tv = prandom_u32() % in_dev->mr_maxdelay; |
224 | 224 | ||
225 | in_dev->mr_gq_running = 1; | 225 | in_dev->mr_gq_running = 1; |
226 | if (!mod_timer(&in_dev->mr_gq_timer, jiffies+tv+2)) | 226 | if (!mod_timer(&in_dev->mr_gq_timer, jiffies+tv+2)) |
@@ -229,7 +229,7 @@ static void igmp_gq_start_timer(struct in_device *in_dev) | |||
229 | 229 | ||
230 | static void igmp_ifc_start_timer(struct in_device *in_dev, int delay) | 230 | static void igmp_ifc_start_timer(struct in_device *in_dev, int delay) |
231 | { | 231 | { |
232 | int tv = net_random() % delay; | 232 | int tv = prandom_u32() % delay; |
233 | 233 | ||
234 | if (!mod_timer(&in_dev->mr_ifc_timer, jiffies+tv+2)) | 234 | if (!mod_timer(&in_dev->mr_ifc_timer, jiffies+tv+2)) |
235 | in_dev_hold(in_dev); | 235 | in_dev_hold(in_dev); |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index fc0e649cc002..0d1e2cb877ec 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -109,7 +109,7 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum) | |||
109 | again: | 109 | again: |
110 | inet_get_local_port_range(net, &low, &high); | 110 | inet_get_local_port_range(net, &low, &high); |
111 | remaining = (high - low) + 1; | 111 | remaining = (high - low) + 1; |
112 | smallest_rover = rover = net_random() % remaining + low; | 112 | smallest_rover = rover = prandom_u32() % remaining + low; |
113 | 113 | ||
114 | smallest_size = -1; | 114 | smallest_size = -1; |
115 | do { | 115 | do { |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 80f649fbee63..3d3141fd0580 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -223,7 +223,7 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum, | |||
223 | inet_get_local_port_range(net, &low, &high); | 223 | inet_get_local_port_range(net, &low, &high); |
224 | remaining = (high - low) + 1; | 224 | remaining = (high - low) + 1; |
225 | 225 | ||
226 | rand = net_random(); | 226 | rand = prandom_u32(); |
227 | first = (((u64)rand * remaining) >> 32) + low; | 227 | first = (((u64)rand * remaining) >> 32) + low; |
228 | /* | 228 | /* |
229 | * force rand to be an odd multiple of UDP_HTABLE_SIZE | 229 | * force rand to be an odd multiple of UDP_HTABLE_SIZE |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index b0cd122e5fb4..5329cccf55dc 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -3104,7 +3104,7 @@ static void addrconf_dad_kick(struct inet6_ifaddr *ifp) | |||
3104 | if (ifp->flags & IFA_F_OPTIMISTIC) | 3104 | if (ifp->flags & IFA_F_OPTIMISTIC) |
3105 | rand_num = 0; | 3105 | rand_num = 0; |
3106 | else | 3106 | else |
3107 | rand_num = net_random() % (idev->cnf.rtr_solicit_delay ? : 1); | 3107 | rand_num = prandom_u32() % (idev->cnf.rtr_solicit_delay ? : 1); |
3108 | 3108 | ||
3109 | ifp->dad_probes = idev->cnf.dad_transmits; | 3109 | ifp->dad_probes = idev->cnf.dad_transmits; |
3110 | addrconf_mod_dad_timer(ifp, rand_num); | 3110 | addrconf_mod_dad_timer(ifp, rand_num); |
@@ -3117,7 +3117,7 @@ static void addrconf_dad_start(struct inet6_ifaddr *ifp) | |||
3117 | 3117 | ||
3118 | addrconf_join_solict(dev, &ifp->addr); | 3118 | addrconf_join_solict(dev, &ifp->addr); |
3119 | 3119 | ||
3120 | net_srandom(ifp->addr.s6_addr32[3]); | 3120 | prandom_seed((__force u32) ifp->addr.s6_addr32[3]); |
3121 | 3121 | ||
3122 | read_lock_bh(&idev->lock); | 3122 | read_lock_bh(&idev->lock); |
3123 | spin_lock(&ifp->lock); | 3123 | spin_lock(&ifp->lock); |
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index e7fb7106550f..cbc93517b455 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c | |||
@@ -210,7 +210,7 @@ static struct ip6_flowlabel *fl_intern(struct net *net, | |||
210 | spin_lock_bh(&ip6_fl_lock); | 210 | spin_lock_bh(&ip6_fl_lock); |
211 | if (label == 0) { | 211 | if (label == 0) { |
212 | for (;;) { | 212 | for (;;) { |
213 | fl->label = htonl(net_random())&IPV6_FLOWLABEL_MASK; | 213 | fl->label = htonl(prandom_u32())&IPV6_FLOWLABEL_MASK; |
214 | if (fl->label) { | 214 | if (fl->label) { |
215 | lfl = __fl_lookup(net, fl->label); | 215 | lfl = __fl_lookup(net, fl->label); |
216 | if (lfl == NULL) | 216 | if (lfl == NULL) |
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index d18f9f903db6..7ff82b3e54b6 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -999,7 +999,7 @@ bool ipv6_chk_mcast_addr(struct net_device *dev, const struct in6_addr *group, | |||
999 | 999 | ||
1000 | static void mld_gq_start_timer(struct inet6_dev *idev) | 1000 | static void mld_gq_start_timer(struct inet6_dev *idev) |
1001 | { | 1001 | { |
1002 | unsigned long tv = net_random() % idev->mc_maxdelay; | 1002 | unsigned long tv = prandom_u32() % idev->mc_maxdelay; |
1003 | 1003 | ||
1004 | idev->mc_gq_running = 1; | 1004 | idev->mc_gq_running = 1; |
1005 | if (!mod_timer(&idev->mc_gq_timer, jiffies+tv+2)) | 1005 | if (!mod_timer(&idev->mc_gq_timer, jiffies+tv+2)) |
@@ -1015,7 +1015,7 @@ static void mld_gq_stop_timer(struct inet6_dev *idev) | |||
1015 | 1015 | ||
1016 | static void mld_ifc_start_timer(struct inet6_dev *idev, unsigned long delay) | 1016 | static void mld_ifc_start_timer(struct inet6_dev *idev, unsigned long delay) |
1017 | { | 1017 | { |
1018 | unsigned long tv = net_random() % delay; | 1018 | unsigned long tv = prandom_u32() % delay; |
1019 | 1019 | ||
1020 | if (!mod_timer(&idev->mc_ifc_timer, jiffies+tv+2)) | 1020 | if (!mod_timer(&idev->mc_ifc_timer, jiffies+tv+2)) |
1021 | in6_dev_hold(idev); | 1021 | in6_dev_hold(idev); |
@@ -1030,7 +1030,7 @@ static void mld_ifc_stop_timer(struct inet6_dev *idev) | |||
1030 | 1030 | ||
1031 | static void mld_dad_start_timer(struct inet6_dev *idev, unsigned long delay) | 1031 | static void mld_dad_start_timer(struct inet6_dev *idev, unsigned long delay) |
1032 | { | 1032 | { |
1033 | unsigned long tv = net_random() % delay; | 1033 | unsigned long tv = prandom_u32() % delay; |
1034 | 1034 | ||
1035 | if (!mod_timer(&idev->mc_dad_timer, jiffies+tv+2)) | 1035 | if (!mod_timer(&idev->mc_dad_timer, jiffies+tv+2)) |
1036 | in6_dev_hold(idev); | 1036 | in6_dev_hold(idev); |
@@ -1061,7 +1061,7 @@ static void igmp6_group_queried(struct ifmcaddr6 *ma, unsigned long resptime) | |||
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | if (delay >= resptime) | 1063 | if (delay >= resptime) |
1064 | delay = net_random() % resptime; | 1064 | delay = prandom_u32() % resptime; |
1065 | 1065 | ||
1066 | ma->mca_timer.expires = jiffies + delay; | 1066 | ma->mca_timer.expires = jiffies + delay; |
1067 | if (!mod_timer(&ma->mca_timer, jiffies + delay)) | 1067 | if (!mod_timer(&ma->mca_timer, jiffies + delay)) |
@@ -2328,7 +2328,7 @@ static void igmp6_join_group(struct ifmcaddr6 *ma) | |||
2328 | 2328 | ||
2329 | igmp6_send(&ma->mca_addr, ma->idev->dev, ICMPV6_MGM_REPORT); | 2329 | igmp6_send(&ma->mca_addr, ma->idev->dev, ICMPV6_MGM_REPORT); |
2330 | 2330 | ||
2331 | delay = net_random() % unsolicited_report_interval(ma->idev); | 2331 | delay = prandom_u32() % unsolicited_report_interval(ma->idev); |
2332 | 2332 | ||
2333 | spin_lock_bh(&ma->mca_lock); | 2333 | spin_lock_bh(&ma->mca_lock); |
2334 | if (del_timer(&ma->mca_timer)) { | 2334 | if (del_timer(&ma->mca_timer)) { |
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c index 4c8e5c0aa1ab..59a1a85bcb3e 100644 --- a/net/netfilter/ipvs/ip_vs_conn.c +++ b/net/netfilter/ipvs/ip_vs_conn.c | |||
@@ -1209,7 +1209,7 @@ void ip_vs_random_dropentry(struct net *net) | |||
1209 | * Randomly scan 1/32 of the whole table every second | 1209 | * Randomly scan 1/32 of the whole table every second |
1210 | */ | 1210 | */ |
1211 | for (idx = 0; idx < (ip_vs_conn_tab_size>>5); idx++) { | 1211 | for (idx = 0; idx < (ip_vs_conn_tab_size>>5); idx++) { |
1212 | unsigned int hash = net_random() & ip_vs_conn_tab_mask; | 1212 | unsigned int hash = prandom_u32() & ip_vs_conn_tab_mask; |
1213 | 1213 | ||
1214 | hlist_for_each_entry_rcu(cp, &ip_vs_conn_tab[hash], c_list) { | 1214 | hlist_for_each_entry_rcu(cp, &ip_vs_conn_tab[hash], c_list) { |
1215 | if (cp->flags & IP_VS_CONN_F_TEMPLATE) | 1215 | if (cp->flags & IP_VS_CONN_F_TEMPLATE) |
diff --git a/net/netfilter/xt_statistic.c b/net/netfilter/xt_statistic.c index 4fe4fb4276d0..11de55e7a868 100644 --- a/net/netfilter/xt_statistic.c +++ b/net/netfilter/xt_statistic.c | |||
@@ -37,7 +37,7 @@ statistic_mt(const struct sk_buff *skb, struct xt_action_param *par) | |||
37 | 37 | ||
38 | switch (info->mode) { | 38 | switch (info->mode) { |
39 | case XT_STATISTIC_MODE_RANDOM: | 39 | case XT_STATISTIC_MODE_RANDOM: |
40 | if ((net_random() & 0x7FFFFFFF) < info->u.random.probability) | 40 | if ((prandom_u32() & 0x7FFFFFFF) < info->u.random.probability) |
41 | ret = !ret; | 41 | ret = !ret; |
42 | break; | 42 | break; |
43 | case XT_STATISTIC_MODE_NTH: | 43 | case XT_STATISTIC_MODE_NTH: |
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index 716b7eebfe70..2c77e7b1a913 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c | |||
@@ -445,7 +445,7 @@ static int sample(struct datapath *dp, struct sk_buff *skb, | |||
445 | a = nla_next(a, &rem)) { | 445 | a = nla_next(a, &rem)) { |
446 | switch (nla_type(a)) { | 446 | switch (nla_type(a)) { |
447 | case OVS_SAMPLE_ATTR_PROBABILITY: | 447 | case OVS_SAMPLE_ATTR_PROBABILITY: |
448 | if (net_random() >= nla_get_u32(a)) | 448 | if (prandom_u32() >= nla_get_u32(a)) |
449 | return 0; | 449 | return 0; |
450 | break; | 450 | break; |
451 | 451 | ||
diff --git a/net/rds/bind.c b/net/rds/bind.c index b5ad65a0067e..a2e6562da751 100644 --- a/net/rds/bind.c +++ b/net/rds/bind.c | |||
@@ -117,7 +117,7 @@ static int rds_add_bound(struct rds_sock *rs, __be32 addr, __be16 *port) | |||
117 | rover = be16_to_cpu(*port); | 117 | rover = be16_to_cpu(*port); |
118 | last = rover; | 118 | last = rover; |
119 | } else { | 119 | } else { |
120 | rover = max_t(u16, net_random(), 2); | 120 | rover = max_t(u16, prandom_u32(), 2); |
121 | last = rover - 1; | 121 | last = rover - 1; |
122 | } | 122 | } |
123 | 123 | ||
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index f26e6b890cc7..31333073cd80 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c | |||
@@ -29,7 +29,7 @@ static struct tcf_hashinfo gact_hash_info; | |||
29 | #ifdef CONFIG_GACT_PROB | 29 | #ifdef CONFIG_GACT_PROB |
30 | static int gact_net_rand(struct tcf_gact *gact) | 30 | static int gact_net_rand(struct tcf_gact *gact) |
31 | { | 31 | { |
32 | if (!gact->tcfg_pval || net_random() % gact->tcfg_pval) | 32 | if (!gact->tcfg_pval || prandom_u32() % gact->tcfg_pval) |
33 | return gact->tcf_action; | 33 | return gact->tcf_action; |
34 | return gact->tcfg_paction; | 34 | return gact->tcfg_paction; |
35 | } | 35 | } |
diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c index 55786283a3df..ba5bc929eac7 100644 --- a/net/sched/sch_fq_codel.c +++ b/net/sched/sch_fq_codel.c | |||
@@ -390,7 +390,7 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt) | |||
390 | sch->limit = 10*1024; | 390 | sch->limit = 10*1024; |
391 | q->flows_cnt = 1024; | 391 | q->flows_cnt = 1024; |
392 | q->quantum = psched_mtu(qdisc_dev(sch)); | 392 | q->quantum = psched_mtu(qdisc_dev(sch)); |
393 | q->perturbation = net_random(); | 393 | q->perturbation = prandom_u32(); |
394 | INIT_LIST_HEAD(&q->new_flows); | 394 | INIT_LIST_HEAD(&q->new_flows); |
395 | INIT_LIST_HEAD(&q->old_flows); | 395 | INIT_LIST_HEAD(&q->old_flows); |
396 | codel_params_init(&q->cparams); | 396 | codel_params_init(&q->cparams); |
diff --git a/net/sched/sch_hhf.c b/net/sched/sch_hhf.c index 1cf84a9e13aa..647680b1c625 100644 --- a/net/sched/sch_hhf.c +++ b/net/sched/sch_hhf.c | |||
@@ -607,7 +607,7 @@ static int hhf_init(struct Qdisc *sch, struct nlattr *opt) | |||
607 | 607 | ||
608 | sch->limit = 1000; | 608 | sch->limit = 1000; |
609 | q->quantum = psched_mtu(qdisc_dev(sch)); | 609 | q->quantum = psched_mtu(qdisc_dev(sch)); |
610 | q->perturbation = net_random(); | 610 | q->perturbation = prandom_u32(); |
611 | INIT_LIST_HEAD(&q->new_buckets); | 611 | INIT_LIST_HEAD(&q->new_buckets); |
612 | INIT_LIST_HEAD(&q->old_buckets); | 612 | INIT_LIST_HEAD(&q->old_buckets); |
613 | 613 | ||
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 090a4e3ecd0d..3019c10d6c56 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -169,7 +169,7 @@ static inline struct netem_skb_cb *netem_skb_cb(struct sk_buff *skb) | |||
169 | static void init_crandom(struct crndstate *state, unsigned long rho) | 169 | static void init_crandom(struct crndstate *state, unsigned long rho) |
170 | { | 170 | { |
171 | state->rho = rho; | 171 | state->rho = rho; |
172 | state->last = net_random(); | 172 | state->last = prandom_u32(); |
173 | } | 173 | } |
174 | 174 | ||
175 | /* get_crandom - correlated random number generator | 175 | /* get_crandom - correlated random number generator |
@@ -182,9 +182,9 @@ static u32 get_crandom(struct crndstate *state) | |||
182 | unsigned long answer; | 182 | unsigned long answer; |
183 | 183 | ||
184 | if (state->rho == 0) /* no correlation */ | 184 | if (state->rho == 0) /* no correlation */ |
185 | return net_random(); | 185 | return prandom_u32(); |
186 | 186 | ||
187 | value = net_random(); | 187 | value = prandom_u32(); |
188 | rho = (u64)state->rho + 1; | 188 | rho = (u64)state->rho + 1; |
189 | answer = (value * ((1ull<<32) - rho) + state->last * rho) >> 32; | 189 | answer = (value * ((1ull<<32) - rho) + state->last * rho) >> 32; |
190 | state->last = answer; | 190 | state->last = answer; |
@@ -198,7 +198,7 @@ static u32 get_crandom(struct crndstate *state) | |||
198 | static bool loss_4state(struct netem_sched_data *q) | 198 | static bool loss_4state(struct netem_sched_data *q) |
199 | { | 199 | { |
200 | struct clgstate *clg = &q->clg; | 200 | struct clgstate *clg = &q->clg; |
201 | u32 rnd = net_random(); | 201 | u32 rnd = prandom_u32(); |
202 | 202 | ||
203 | /* | 203 | /* |
204 | * Makes a comparison between rnd and the transition | 204 | * Makes a comparison between rnd and the transition |
@@ -264,15 +264,15 @@ static bool loss_gilb_ell(struct netem_sched_data *q) | |||
264 | 264 | ||
265 | switch (clg->state) { | 265 | switch (clg->state) { |
266 | case 1: | 266 | case 1: |
267 | if (net_random() < clg->a1) | 267 | if (prandom_u32() < clg->a1) |
268 | clg->state = 2; | 268 | clg->state = 2; |
269 | if (net_random() < clg->a4) | 269 | if (prandom_u32() < clg->a4) |
270 | return true; | 270 | return true; |
271 | break; | 271 | break; |
272 | case 2: | 272 | case 2: |
273 | if (net_random() < clg->a2) | 273 | if (prandom_u32() < clg->a2) |
274 | clg->state = 1; | 274 | clg->state = 1; |
275 | if (net_random() > clg->a3) | 275 | if (prandom_u32() > clg->a3) |
276 | return true; | 276 | return true; |
277 | } | 277 | } |
278 | 278 | ||
@@ -457,7 +457,8 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
457 | skb_checksum_help(skb))) | 457 | skb_checksum_help(skb))) |
458 | return qdisc_drop(skb, sch); | 458 | return qdisc_drop(skb, sch); |
459 | 459 | ||
460 | skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8); | 460 | skb->data[prandom_u32() % skb_headlen(skb)] ^= |
461 | 1<<(prandom_u32() % 8); | ||
461 | } | 462 | } |
462 | 463 | ||
463 | if (unlikely(skb_queue_len(&sch->q) >= sch->limit)) | 464 | if (unlikely(skb_queue_len(&sch->q) >= sch->limit)) |
diff --git a/net/sched/sch_pie.c b/net/sched/sch_pie.c index fe65340c8eb4..a255d0200a59 100644 --- a/net/sched/sch_pie.c +++ b/net/sched/sch_pie.c | |||
@@ -122,7 +122,7 @@ static bool drop_early(struct Qdisc *sch, u32 packet_size) | |||
122 | else | 122 | else |
123 | local_prob = q->vars.prob; | 123 | local_prob = q->vars.prob; |
124 | 124 | ||
125 | rnd = net_random(); | 125 | rnd = prandom_u32(); |
126 | if (rnd < local_prob) | 126 | if (rnd < local_prob) |
127 | return true; | 127 | return true; |
128 | 128 | ||
diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c index 30ea4674cabd..9b0f7093d970 100644 --- a/net/sched/sch_sfb.c +++ b/net/sched/sch_sfb.c | |||
@@ -220,7 +220,7 @@ static u32 sfb_compute_qlen(u32 *prob_r, u32 *avgpm_r, const struct sfb_sched_da | |||
220 | 220 | ||
221 | static void sfb_init_perturbation(u32 slot, struct sfb_sched_data *q) | 221 | static void sfb_init_perturbation(u32 slot, struct sfb_sched_data *q) |
222 | { | 222 | { |
223 | q->bins[slot].perturbation = net_random(); | 223 | q->bins[slot].perturbation = prandom_u32(); |
224 | } | 224 | } |
225 | 225 | ||
226 | static void sfb_swap_slot(struct sfb_sched_data *q) | 226 | static void sfb_swap_slot(struct sfb_sched_data *q) |
@@ -381,7 +381,7 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
381 | goto enqueue; | 381 | goto enqueue; |
382 | } | 382 | } |
383 | 383 | ||
384 | r = net_random() & SFB_MAX_PROB; | 384 | r = prandom_u32() & SFB_MAX_PROB; |
385 | 385 | ||
386 | if (unlikely(r < p_min)) { | 386 | if (unlikely(r < p_min)) { |
387 | if (unlikely(p_min > SFB_MAX_PROB / 2)) { | 387 | if (unlikely(p_min > SFB_MAX_PROB / 2)) { |
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index 76f01e0258df..87317ff0b4ec 100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c | |||
@@ -629,7 +629,7 @@ static void sfq_perturbation(unsigned long arg) | |||
629 | spinlock_t *root_lock = qdisc_lock(qdisc_root_sleeping(sch)); | 629 | spinlock_t *root_lock = qdisc_lock(qdisc_root_sleeping(sch)); |
630 | 630 | ||
631 | spin_lock(root_lock); | 631 | spin_lock(root_lock); |
632 | q->perturbation = net_random(); | 632 | q->perturbation = prandom_u32(); |
633 | if (!q->filter_list && q->tail) | 633 | if (!q->filter_list && q->tail) |
634 | sfq_rehash(sch); | 634 | sfq_rehash(sch); |
635 | spin_unlock(root_lock); | 635 | spin_unlock(root_lock); |
@@ -698,7 +698,7 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt) | |||
698 | del_timer(&q->perturb_timer); | 698 | del_timer(&q->perturb_timer); |
699 | if (q->perturb_period) { | 699 | if (q->perturb_period) { |
700 | mod_timer(&q->perturb_timer, jiffies + q->perturb_period); | 700 | mod_timer(&q->perturb_timer, jiffies + q->perturb_period); |
701 | q->perturbation = net_random(); | 701 | q->perturbation = prandom_u32(); |
702 | } | 702 | } |
703 | sch_tree_unlock(sch); | 703 | sch_tree_unlock(sch); |
704 | kfree(p); | 704 | kfree(p); |
@@ -759,7 +759,7 @@ static int sfq_init(struct Qdisc *sch, struct nlattr *opt) | |||
759 | q->quantum = psched_mtu(qdisc_dev(sch)); | 759 | q->quantum = psched_mtu(qdisc_dev(sch)); |
760 | q->scaled_quantum = SFQ_ALLOT_SIZE(q->quantum); | 760 | q->scaled_quantum = SFQ_ALLOT_SIZE(q->quantum); |
761 | q->perturb_period = 0; | 761 | q->perturb_period = 0; |
762 | q->perturbation = net_random(); | 762 | q->perturbation = prandom_u32(); |
763 | 763 | ||
764 | if (opt) { | 764 | if (opt) { |
765 | int err = sfq_change(sch, opt); | 765 | int err = sfq_change(sch, opt); |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index d32dae78a486..7cc62b922f12 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -5926,7 +5926,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) | |||
5926 | 5926 | ||
5927 | inet_get_local_port_range(sock_net(sk), &low, &high); | 5927 | inet_get_local_port_range(sock_net(sk), &low, &high); |
5928 | remaining = (high - low) + 1; | 5928 | remaining = (high - low) + 1; |
5929 | rover = net_random() % remaining + low; | 5929 | rover = prandom_u32() % remaining + low; |
5930 | 5930 | ||
5931 | do { | 5931 | do { |
5932 | rover++; | 5932 | rover++; |
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index a72de074172d..e521d20e1970 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -619,7 +619,7 @@ static void cache_limit_defers(void) | |||
619 | 619 | ||
620 | /* Consider removing either the first or the last */ | 620 | /* Consider removing either the first or the last */ |
621 | if (cache_defer_cnt > DFR_MAX) { | 621 | if (cache_defer_cnt > DFR_MAX) { |
622 | if (net_random() & 1) | 622 | if (prandom_u32() & 1) |
623 | discard = list_entry(cache_defer_list.next, | 623 | discard = list_entry(cache_defer_list.next, |
624 | struct cache_deferred_req, recent); | 624 | struct cache_deferred_req, recent); |
625 | else | 625 | else |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 04199bc8416f..1750048130a7 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -1188,7 +1188,7 @@ static inline __be32 xprt_alloc_xid(struct rpc_xprt *xprt) | |||
1188 | 1188 | ||
1189 | static inline void xprt_init_xid(struct rpc_xprt *xprt) | 1189 | static inline void xprt_init_xid(struct rpc_xprt *xprt) |
1190 | { | 1190 | { |
1191 | xprt->xid = net_random(); | 1191 | xprt->xid = prandom_u32(); |
1192 | } | 1192 | } |
1193 | 1193 | ||
1194 | static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt) | 1194 | static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt) |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index dd9d295813cf..75b045e1cd50 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -1674,7 +1674,7 @@ static void xs_udp_timer(struct rpc_xprt *xprt, struct rpc_task *task) | |||
1674 | static unsigned short xs_get_random_port(void) | 1674 | static unsigned short xs_get_random_port(void) |
1675 | { | 1675 | { |
1676 | unsigned short range = xprt_max_resvport - xprt_min_resvport; | 1676 | unsigned short range = xprt_max_resvport - xprt_min_resvport; |
1677 | unsigned short rand = (unsigned short) net_random() % range; | 1677 | unsigned short rand = (unsigned short) prandom_u32() % range; |
1678 | return rand + xprt_min_resvport; | 1678 | return rand + xprt_min_resvport; |
1679 | } | 1679 | } |
1680 | 1680 | ||
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 62181486ead8..8d11d28991a4 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -1565,7 +1565,7 @@ int xfrm_alloc_spi(struct xfrm_state *x, u32 low, u32 high) | |||
1565 | } else { | 1565 | } else { |
1566 | u32 spi = 0; | 1566 | u32 spi = 0; |
1567 | for (h = 0; h < high-low+1; h++) { | 1567 | for (h = 0; h < high-low+1; h++) { |
1568 | spi = low + net_random()%(high-low+1); | 1568 | spi = low + prandom_u32()%(high-low+1); |
1569 | x0 = xfrm_state_lookup(net, mark, &x->id.daddr, htonl(spi), x->id.proto, x->props.family); | 1569 | x0 = xfrm_state_lookup(net, mark, &x->id.daddr, htonl(spi), x->id.proto, x->props.family); |
1570 | if (x0 == NULL) { | 1570 | if (x0 == NULL) { |
1571 | x->id.spi = htonl(spi); | 1571 | x->id.spi = htonl(spi); |