]> Pileus Git - ~andy/linux/commitdiff
net: replace macros net_random and net_srandom with direct calls to prandom
authorAruna-Hewapathirane <aruna.hewapathirane@gmail.com>
Sat, 11 Jan 2014 12:15:59 +0000 (07:15 -0500)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Jan 2014 23:15:25 +0000 (15:15 -0800)
This patch removes the net_random and net_srandom macros and replaces
them with direct calls to the prandom ones. As new commits only seem to
use prandom_u32 there is no use to keep them around.
This change makes it easier to grep for users of prandom_u32.

Signed-off-by: Aruna-Hewapathirane <aruna.hewapathirane@gmail.com>
Suggested-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
30 files changed:
drivers/infiniband/core/cma.c
include/linux/net.h
include/net/red.h
net/802/garp.c
net/802/mrp.c
net/core/neighbour.c
net/core/stream.c
net/ipv4/devinet.c
net/ipv4/igmp.c
net/ipv4/inet_connection_sock.c
net/ipv4/udp.c
net/ipv6/addrconf.c
net/ipv6/ip6_flowlabel.c
net/ipv6/mcast.c
net/netfilter/ipvs/ip_vs_conn.c
net/netfilter/xt_statistic.c
net/openvswitch/actions.c
net/rds/bind.c
net/sched/act_gact.c
net/sched/sch_fq_codel.c
net/sched/sch_hhf.c
net/sched/sch_netem.c
net/sched/sch_pie.c
net/sched/sch_sfb.c
net/sched/sch_sfq.c
net/sctp/socket.c
net/sunrpc/cache.c
net/sunrpc/xprt.c
net/sunrpc/xprtsock.c
net/xfrm/xfrm_state.c

index 8e49db690f33e9a67f71cbcca8b62c9d92fde9f4..6c17f2dc0f09d8a587ef812b4be70645390a3257 100644 (file)
@@ -2310,7 +2310,7 @@ static int cma_alloc_any_port(struct idr *ps, struct rdma_id_private *id_priv)
 
        inet_get_local_port_range(&init_net, &low, &high);
        remaining = (high - low) + 1;
-       rover = net_random() % remaining + low;
+       rover = prandom_u32() % remaining + low;
 retry:
        if (last_used_port != rover &&
            !idr_find(ps, (unsigned short) rover)) {
index 69be3e6079c8c9320cff6598b8ba33ff1cdfb1f8..94734a6259a4d9ee36e25b342c86d3c1bf9d5fcf 100644 (file)
@@ -245,9 +245,6 @@ do {                                                                \
 #define net_dbg_ratelimited(fmt, ...)                          \
        net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
 
-#define net_random()           prandom_u32()
-#define net_srandom(seed)      prandom_seed((__force u32)(seed))
-
 bool __net_get_random_once(void *buf, int nbytes, bool *done,
                           struct static_key *done_key);
 
index ef46058d35bf0de1fdabf80915594f9d201a0a5c..168bb2f495f207511bffe485c1070ea8bb6df30a 100644 (file)
@@ -303,7 +303,7 @@ static inline unsigned long red_calc_qavg(const struct red_parms *p,
 
 static inline u32 red_random(const struct red_parms *p)
 {
-       return reciprocal_divide(net_random(), p->max_P_reciprocal);
+       return reciprocal_divide(prandom_u32(), p->max_P_reciprocal);
 }
 
 static inline int red_mark_probability(const struct red_parms *p,
index 5d9630a0eb93b75604f49f3c9de84ad7a417de03..b38ee6dcba45fe4099029a6ac51ab38391c653d0 100644 (file)
@@ -397,7 +397,7 @@ static void garp_join_timer_arm(struct garp_applicant *app)
 {
        unsigned long delay;
 
-       delay = (u64)msecs_to_jiffies(garp_join_time) * net_random() >> 32;
+       delay = (u64)msecs_to_jiffies(garp_join_time) * prandom_u32() >> 32;
        mod_timer(&app->join_timer, jiffies + delay);
 }
 
index 3ed616215870cf73b4d8a516d52e5da04d9472e5..72db2785ef2c010fc20718e20e18e6511cd5a5dd 100644 (file)
@@ -583,7 +583,7 @@ static void mrp_join_timer_arm(struct mrp_applicant *app)
 {
        unsigned long delay;
 
-       delay = (u64)msecs_to_jiffies(mrp_join_time) * net_random() >> 32;
+       delay = (u64)msecs_to_jiffies(mrp_join_time) * prandom_u32() >> 32;
        mod_timer(&app->join_timer, jiffies + delay);
 }
 
index ea97361f0e9bfd7524f040b575456dc2ec2e2e9d..e360d9e65c0401020218e9c0c7b057743c4ac919 100644 (file)
@@ -117,7 +117,7 @@ static void neigh_cleanup_and_release(struct neighbour *neigh)
 
 unsigned long neigh_rand_reach_time(unsigned long base)
 {
-       return base ? (net_random() % base) + (base >> 1) : 0;
+       return base ? (prandom_u32() % base) + (base >> 1) : 0;
 }
 EXPORT_SYMBOL(neigh_rand_reach_time);
 
@@ -1415,7 +1415,8 @@ void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p,
                    struct sk_buff *skb)
 {
        unsigned long now = jiffies;
-       unsigned long sched_next = now + (net_random() %
+
+       unsigned long sched_next = now + (prandom_u32() %
                                          NEIGH_VAR(p, PROXY_DELAY));
 
        if (tbl->proxy_queue.qlen > NEIGH_VAR(p, PROXY_QLEN)) {
index 512f0a24269b59cc45baa14c13e586b34fce9b60..301c05f260600caaed94a9f63ecd3ed0adc5c233 100644 (file)
@@ -122,7 +122,7 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p)
        DEFINE_WAIT(wait);
 
        if (sk_stream_memory_free(sk))
-               current_timeo = vm_wait = (net_random() % (HZ / 5)) + 2;
+               current_timeo = vm_wait = (prandom_u32() % (HZ / 5)) + 2;
 
        while (1) {
                set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
index 9809f7b69728cb335e0963c92ea4c9522842849f..646023bd5449705f138fd2a01d9720a3cecc45e8 100644 (file)
@@ -464,7 +464,7 @@ static int __inet_insert_ifa(struct in_ifaddr *ifa, struct nlmsghdr *nlh,
        }
 
        if (!(ifa->ifa_flags & IFA_F_SECONDARY)) {
-               net_srandom(ifa->ifa_local);
+               prandom_seed((__force u32) ifa->ifa_local);
                ifap = last_primary;
        }
 
index bcbf33e58324d33aeccd398b2e3a8d9f11e98990..97e4d1655d26bb65121c1a8954af2d7565c288a6 100644 (file)
@@ -211,7 +211,7 @@ static void igmp_stop_timer(struct ip_mc_list *im)
 /* It must be called with locked im->lock */
 static void igmp_start_timer(struct ip_mc_list *im, int max_delay)
 {
-       int tv = net_random() % max_delay;
+       int tv = prandom_u32() % max_delay;
 
        im->tm_running = 1;
        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)
 
 static void igmp_gq_start_timer(struct in_device *in_dev)
 {
-       int tv = net_random() % in_dev->mr_maxdelay;
+       int tv = prandom_u32() % in_dev->mr_maxdelay;
 
        in_dev->mr_gq_running = 1;
        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)
 
 static void igmp_ifc_start_timer(struct in_device *in_dev, int delay)
 {
-       int tv = net_random() % delay;
+       int tv = prandom_u32() % delay;
 
        if (!mod_timer(&in_dev->mr_ifc_timer, jiffies+tv+2))
                in_dev_hold(in_dev);
index fc0e649cc002beb0631c390e6aed5f1ea3fe7390..0d1e2cb877ec43692c5a7b4fe57e16cf921a8c97 100644 (file)
@@ -109,7 +109,7 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum)
 again:
                inet_get_local_port_range(net, &low, &high);
                remaining = (high - low) + 1;
-               smallest_rover = rover = net_random() % remaining + low;
+               smallest_rover = rover = prandom_u32() % remaining + low;
 
                smallest_size = -1;
                do {
index 80f649fbee63885d59d845c32206f59b21d98fe2..3d3141fd0580410b667d511abb4fec7b883e9c7e 100644 (file)
@@ -223,7 +223,7 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
                inet_get_local_port_range(net, &low, &high);
                remaining = (high - low) + 1;
 
-               rand = net_random();
+               rand = prandom_u32();
                first = (((u64)rand * remaining) >> 32) + low;
                /*
                 * force rand to be an odd multiple of UDP_HTABLE_SIZE
index b0cd122e5fb426b00466fd21af94b4d9ad72fc4f..5329cccf55dc7e3e77573206f0f07570e5d40420 100644 (file)
@@ -3104,7 +3104,7 @@ static void addrconf_dad_kick(struct inet6_ifaddr *ifp)
        if (ifp->flags & IFA_F_OPTIMISTIC)
                rand_num = 0;
        else
-               rand_num = net_random() % (idev->cnf.rtr_solicit_delay ? : 1);
+               rand_num = prandom_u32() % (idev->cnf.rtr_solicit_delay ? : 1);
 
        ifp->dad_probes = idev->cnf.dad_transmits;
        addrconf_mod_dad_timer(ifp, rand_num);
@@ -3117,7 +3117,7 @@ static void addrconf_dad_start(struct inet6_ifaddr *ifp)
 
        addrconf_join_solict(dev, &ifp->addr);
 
-       net_srandom(ifp->addr.s6_addr32[3]);
+       prandom_seed((__force u32) ifp->addr.s6_addr32[3]);
 
        read_lock_bh(&idev->lock);
        spin_lock(&ifp->lock);
index e7fb7106550f1d0c45bfa59b341681175be588b2..cbc93517b455a1009dbf9754e3162d92da226c57 100644 (file)
@@ -210,7 +210,7 @@ static struct ip6_flowlabel *fl_intern(struct net *net,
        spin_lock_bh(&ip6_fl_lock);
        if (label == 0) {
                for (;;) {
-                       fl->label = htonl(net_random())&IPV6_FLOWLABEL_MASK;
+                       fl->label = htonl(prandom_u32())&IPV6_FLOWLABEL_MASK;
                        if (fl->label) {
                                lfl = __fl_lookup(net, fl->label);
                                if (lfl == NULL)
index d18f9f903db62333983d3fad0e1ccb9298762c98..7ff82b3e54b6be3264e09a0925868799e0d4e90d 100644 (file)
@@ -999,7 +999,7 @@ bool ipv6_chk_mcast_addr(struct net_device *dev, const struct in6_addr *group,
 
 static void mld_gq_start_timer(struct inet6_dev *idev)
 {
-       unsigned long tv = net_random() % idev->mc_maxdelay;
+       unsigned long tv = prandom_u32() % idev->mc_maxdelay;
 
        idev->mc_gq_running = 1;
        if (!mod_timer(&idev->mc_gq_timer, jiffies+tv+2))
@@ -1015,7 +1015,7 @@ static void mld_gq_stop_timer(struct inet6_dev *idev)
 
 static void mld_ifc_start_timer(struct inet6_dev *idev, unsigned long delay)
 {
-       unsigned long tv = net_random() % delay;
+       unsigned long tv = prandom_u32() % delay;
 
        if (!mod_timer(&idev->mc_ifc_timer, jiffies+tv+2))
                in6_dev_hold(idev);
@@ -1030,7 +1030,7 @@ static void mld_ifc_stop_timer(struct inet6_dev *idev)
 
 static void mld_dad_start_timer(struct inet6_dev *idev, unsigned long delay)
 {
-       unsigned long tv = net_random() % delay;
+       unsigned long tv = prandom_u32() % delay;
 
        if (!mod_timer(&idev->mc_dad_timer, jiffies+tv+2))
                in6_dev_hold(idev);
@@ -1061,7 +1061,7 @@ static void igmp6_group_queried(struct ifmcaddr6 *ma, unsigned long resptime)
        }
 
        if (delay >= resptime)
-               delay = net_random() % resptime;
+               delay = prandom_u32() % resptime;
 
        ma->mca_timer.expires = jiffies + delay;
        if (!mod_timer(&ma->mca_timer, jiffies + delay))
@@ -2328,7 +2328,7 @@ static void igmp6_join_group(struct ifmcaddr6 *ma)
 
        igmp6_send(&ma->mca_addr, ma->idev->dev, ICMPV6_MGM_REPORT);
 
-       delay = net_random() % unsolicited_report_interval(ma->idev);
+       delay = prandom_u32() % unsolicited_report_interval(ma->idev);
 
        spin_lock_bh(&ma->mca_lock);
        if (del_timer(&ma->mca_timer)) {
index 4c8e5c0aa1aba96b03fae69ce153056a10bb7b95..59a1a85bcb3eb888348cbc818789ebb16aa01cc9 100644 (file)
@@ -1209,7 +1209,7 @@ void ip_vs_random_dropentry(struct net *net)
         * Randomly scan 1/32 of the whole table every second
         */
        for (idx = 0; idx < (ip_vs_conn_tab_size>>5); idx++) {
-               unsigned int hash = net_random() & ip_vs_conn_tab_mask;
+               unsigned int hash = prandom_u32() & ip_vs_conn_tab_mask;
 
                hlist_for_each_entry_rcu(cp, &ip_vs_conn_tab[hash], c_list) {
                        if (cp->flags & IP_VS_CONN_F_TEMPLATE)
index 4fe4fb4276d0076061610418b8154e9d11cd80b8..11de55e7a868950c6b9ad5bbfa0a0561eb8787d7 100644 (file)
@@ -37,7 +37,7 @@ statistic_mt(const struct sk_buff *skb, struct xt_action_param *par)
 
        switch (info->mode) {
        case XT_STATISTIC_MODE_RANDOM:
-               if ((net_random() & 0x7FFFFFFF) < info->u.random.probability)
+               if ((prandom_u32() & 0x7FFFFFFF) < info->u.random.probability)
                        ret = !ret;
                break;
        case XT_STATISTIC_MODE_NTH:
index 716b7eebfe70dd46e52dc933c770db9c9133cb6f..2c77e7b1a913241d85f11d19c25b5e182b5757f1 100644 (file)
@@ -445,7 +445,7 @@ static int sample(struct datapath *dp, struct sk_buff *skb,
                 a = nla_next(a, &rem)) {
                switch (nla_type(a)) {
                case OVS_SAMPLE_ATTR_PROBABILITY:
-                       if (net_random() >= nla_get_u32(a))
+                       if (prandom_u32() >= nla_get_u32(a))
                                return 0;
                        break;
 
index b5ad65a0067ea2c96e2328788b274965efdf9238..a2e6562da751f79bd9524c7e434f1d1d02d3b4fe 100644 (file)
@@ -117,7 +117,7 @@ static int rds_add_bound(struct rds_sock *rs, __be32 addr, __be16 *port)
                rover = be16_to_cpu(*port);
                last = rover;
        } else {
-               rover = max_t(u16, net_random(), 2);
+               rover = max_t(u16, prandom_u32(), 2);
                last = rover - 1;
        }
 
index f26e6b890cc7aefb35a4844f994e0a1a2d908fed..31333073cd8084cfa56975eb29378f6f1a35b328 100644 (file)
@@ -29,7 +29,7 @@ static struct tcf_hashinfo gact_hash_info;
 #ifdef CONFIG_GACT_PROB
 static int gact_net_rand(struct tcf_gact *gact)
 {
-       if (!gact->tcfg_pval || net_random() % gact->tcfg_pval)
+       if (!gact->tcfg_pval || prandom_u32() % gact->tcfg_pval)
                return gact->tcf_action;
        return gact->tcfg_paction;
 }
index 55786283a3dfe613ee6deac5756b4726a66925ee..ba5bc929eac732900c1d6e3150ad224f3a50a1ae 100644 (file)
@@ -390,7 +390,7 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt)
        sch->limit = 10*1024;
        q->flows_cnt = 1024;
        q->quantum = psched_mtu(qdisc_dev(sch));
-       q->perturbation = net_random();
+       q->perturbation = prandom_u32();
        INIT_LIST_HEAD(&q->new_flows);
        INIT_LIST_HEAD(&q->old_flows);
        codel_params_init(&q->cparams);
index 1cf84a9e13aa80f5be0d1410018d773163a0d238..647680b1c625ec9ca41adff446cd2bc32bc76a54 100644 (file)
@@ -607,7 +607,7 @@ static int hhf_init(struct Qdisc *sch, struct nlattr *opt)
 
        sch->limit = 1000;
        q->quantum = psched_mtu(qdisc_dev(sch));
-       q->perturbation = net_random();
+       q->perturbation = prandom_u32();
        INIT_LIST_HEAD(&q->new_buckets);
        INIT_LIST_HEAD(&q->old_buckets);
 
index 090a4e3ecd0dc76b79d916eef416554fd41651d5..3019c10d6c5631d96a7a0280b212caf136b12c16 100644 (file)
@@ -169,7 +169,7 @@ static inline struct netem_skb_cb *netem_skb_cb(struct sk_buff *skb)
 static void init_crandom(struct crndstate *state, unsigned long rho)
 {
        state->rho = rho;
-       state->last = net_random();
+       state->last = prandom_u32();
 }
 
 /* get_crandom - correlated random number generator
@@ -182,9 +182,9 @@ static u32 get_crandom(struct crndstate *state)
        unsigned long answer;
 
        if (state->rho == 0)    /* no correlation */
-               return net_random();
+               return prandom_u32();
 
-       value = net_random();
+       value = prandom_u32();
        rho = (u64)state->rho + 1;
        answer = (value * ((1ull<<32) - rho) + state->last * rho) >> 32;
        state->last = answer;
@@ -198,7 +198,7 @@ static u32 get_crandom(struct crndstate *state)
 static bool loss_4state(struct netem_sched_data *q)
 {
        struct clgstate *clg = &q->clg;
-       u32 rnd = net_random();
+       u32 rnd = prandom_u32();
 
        /*
         * Makes a comparison between rnd and the transition
@@ -264,15 +264,15 @@ static bool loss_gilb_ell(struct netem_sched_data *q)
 
        switch (clg->state) {
        case 1:
-               if (net_random() < clg->a1)
+               if (prandom_u32() < clg->a1)
                        clg->state = 2;
-               if (net_random() < clg->a4)
+               if (prandom_u32() < clg->a4)
                        return true;
                break;
        case 2:
-               if (net_random() < clg->a2)
+               if (prandom_u32() < clg->a2)
                        clg->state = 1;
-               if (net_random() > clg->a3)
+               if (prandom_u32() > clg->a3)
                        return true;
        }
 
@@ -457,7 +457,8 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
                     skb_checksum_help(skb)))
                        return qdisc_drop(skb, sch);
 
-               skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8);
+               skb->data[prandom_u32() % skb_headlen(skb)] ^=
+                       1<<(prandom_u32() % 8);
        }
 
        if (unlikely(skb_queue_len(&sch->q) >= sch->limit))
index fe65340c8eb41b87be964167433f8bc62fc35ea6..a255d0200a593a708a6f30f4e9dbb70fabb917c3 100644 (file)
@@ -122,7 +122,7 @@ static bool drop_early(struct Qdisc *sch, u32 packet_size)
        else
                local_prob = q->vars.prob;
 
-       rnd = net_random();
+       rnd = prandom_u32();
        if (rnd < local_prob)
                return true;
 
index 30ea4674cabd2a735c47af22239ab006b1c2e826..9b0f7093d970da5fa37130a5df926d5c428191ec 100644 (file)
@@ -220,7 +220,7 @@ static u32 sfb_compute_qlen(u32 *prob_r, u32 *avgpm_r, const struct sfb_sched_da
 
 static void sfb_init_perturbation(u32 slot, struct sfb_sched_data *q)
 {
-       q->bins[slot].perturbation = net_random();
+       q->bins[slot].perturbation = prandom_u32();
 }
 
 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)
                goto enqueue;
        }
 
-       r = net_random() & SFB_MAX_PROB;
+       r = prandom_u32() & SFB_MAX_PROB;
 
        if (unlikely(r < p_min)) {
                if (unlikely(p_min > SFB_MAX_PROB / 2)) {
index 76f01e0258df4bbfa9065412b4a04bf202541995..87317ff0b4ec4699dae7898405666d2bde6c9897 100644 (file)
@@ -629,7 +629,7 @@ static void sfq_perturbation(unsigned long arg)
        spinlock_t *root_lock = qdisc_lock(qdisc_root_sleeping(sch));
 
        spin_lock(root_lock);
-       q->perturbation = net_random();
+       q->perturbation = prandom_u32();
        if (!q->filter_list && q->tail)
                sfq_rehash(sch);
        spin_unlock(root_lock);
@@ -698,7 +698,7 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt)
        del_timer(&q->perturb_timer);
        if (q->perturb_period) {
                mod_timer(&q->perturb_timer, jiffies + q->perturb_period);
-               q->perturbation = net_random();
+               q->perturbation = prandom_u32();
        }
        sch_tree_unlock(sch);
        kfree(p);
@@ -759,7 +759,7 @@ static int sfq_init(struct Qdisc *sch, struct nlattr *opt)
        q->quantum = psched_mtu(qdisc_dev(sch));
        q->scaled_quantum = SFQ_ALLOT_SIZE(q->quantum);
        q->perturb_period = 0;
-       q->perturbation = net_random();
+       q->perturbation = prandom_u32();
 
        if (opt) {
                int err = sfq_change(sch, opt);
index d32dae78a4868439646dbe3b6d418a90ae5b4305..7cc62b922f122aaf949e9c1e7ac0b8c2718785e1 100644 (file)
@@ -5926,7 +5926,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
 
                inet_get_local_port_range(sock_net(sk), &low, &high);
                remaining = (high - low) + 1;
-               rover = net_random() % remaining + low;
+               rover = prandom_u32() % remaining + low;
 
                do {
                        rover++;
index a72de074172d81a031305dae2f1551b22d9ced36..e521d20e19701d917953e49033ce85fac8a96c8d 100644 (file)
@@ -619,7 +619,7 @@ static void cache_limit_defers(void)
 
        /* Consider removing either the first or the last */
        if (cache_defer_cnt > DFR_MAX) {
-               if (net_random() & 1)
+               if (prandom_u32() & 1)
                        discard = list_entry(cache_defer_list.next,
                                             struct cache_deferred_req, recent);
                else
index 04199bc8416f0c3bd3add838381db36f12130144..1750048130a7c0d305a51c87c38d539ee3001fd7 100644 (file)
@@ -1188,7 +1188,7 @@ static inline __be32 xprt_alloc_xid(struct rpc_xprt *xprt)
 
 static inline void xprt_init_xid(struct rpc_xprt *xprt)
 {
-       xprt->xid = net_random();
+       xprt->xid = prandom_u32();
 }
 
 static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt)
index dd9d295813cff2a8738946a3309fc31dcf57ebf0..75b045e1cd50b00096a3a2ec938c2f82423dffce 100644 (file)
@@ -1674,7 +1674,7 @@ static void xs_udp_timer(struct rpc_xprt *xprt, struct rpc_task *task)
 static unsigned short xs_get_random_port(void)
 {
        unsigned short range = xprt_max_resvport - xprt_min_resvport;
-       unsigned short rand = (unsigned short) net_random() % range;
+       unsigned short rand = (unsigned short) prandom_u32() % range;
        return rand + xprt_min_resvport;
 }
 
index 62181486ead85fa1d2858dc7143bd099ee5094a9..8d11d28991a4b7a0c760e403d578199fae8d9a33 100644 (file)
@@ -1565,7 +1565,7 @@ int xfrm_alloc_spi(struct xfrm_state *x, u32 low, u32 high)
        } else {
                u32 spi = 0;
                for (h = 0; h < high-low+1; h++) {
-                       spi = low + net_random()%(high-low+1);
+                       spi = low + prandom_u32()%(high-low+1);
                        x0 = xfrm_state_lookup(net, mark, &x->id.daddr, htonl(spi), x->id.proto, x->props.family);
                        if (x0 == NULL) {
                                x->id.spi = htonl(spi);