Showing error 1883

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: net/dccp/ccids/lib/loss_interval.c
Line in file: 162
Project: Linux Kernel
Project version: 2.6.28
Tools: Smatch (1.59)
Entered: 2013-09-11 08:47:26 UTC


Source:

132}
133
134/** tfrc_lh_interval_add  -  Insert new record into the Loss Interval database
135 * @lh:                   Loss Interval database
136 * @rh:                   Receive history containing a fresh loss event
137 * @calc_first_li: Caller-dependent routine to compute length of first interval
138 * @sk:                   Used by @calc_first_li in caller-specific way (subtyping)
139 * Updates I_mean and returns 1 if a new interval has in fact been added to @lh.
140 */
141int tfrc_lh_interval_add(struct tfrc_loss_hist *lh, struct tfrc_rx_hist *rh,
142                         u32 (*calc_first_li)(struct sock *), struct sock *sk)
143{
144        struct tfrc_loss_interval *cur = tfrc_lh_peek(lh), *new;
145
146        if (cur != NULL && !tfrc_lh_is_new_loss(cur, tfrc_rx_hist_loss_prev(rh)))
147                return 0;
148
149        new = tfrc_lh_demand_next(lh);
150        if (unlikely(new == NULL)) {
151                DCCP_CRIT("Cannot allocate/add loss record.");
152                return 0;
153        }
154
155        new->li_seqno          = tfrc_rx_hist_loss_prev(rh)->tfrchrx_seqno;
156        new->li_ccval          = tfrc_rx_hist_loss_prev(rh)->tfrchrx_ccval;
157        new->li_is_closed = 0;
158
159        if (++lh->counter == 1)
160                lh->i_mean = new->li_length = (*calc_first_li)(sk);
161        else {
162                cur->li_length = dccp_delta_seqno(cur->li_seqno, new->li_seqno);
163                new->li_length = dccp_delta_seqno(new->li_seqno,
164                                  tfrc_rx_hist_last_rcv(rh)->tfrchrx_seqno) + 1;
165                if (lh->counter > (2*LIH_SIZE))
166                        lh->counter -= LIH_SIZE;
167
168                tfrc_lh_calc_i_mean(lh);
169        }
170        return 1;
171}
172EXPORT_SYMBOL_GPL(tfrc_lh_interval_add);
Show full sources