Skip to content

Commit

Permalink
net: dccp: fix sign bug
Browse files Browse the repository at this point in the history
'gap' is unsigned, so this code is wrong:

    gap = -new_head;
    ...
    if (gap > 0) { ... }

Make 'gap' signed.

The semantic patch that finds this problem (many false-positive results):
(http://coccinelle.lip6.fr/)

// <smpl>
@ r1 @
identifier f;
@@
int f(...) { ... }

@@
identifier r1.f;
type T;
unsigned T x;
@@

*x = f(...)
 ...
*x > 0

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Kulikov Vasiliy authored and David S. Miller committed Jul 18, 2010
1 parent bfc978f commit 8e64159
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/dccp/ackvec.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ static inline int dccp_ackvec_set_buf_head_state(struct dccp_ackvec *av,
const unsigned int packets,
const unsigned char state)
{
unsigned int gap;
long gap;
long new_head;

if (av->av_vec_len + packets > DCCP_MAX_ACKVEC_LEN)
Expand Down

0 comments on commit 8e64159

Please sign in to comment.