Skip to content

Commit 8e64159

Browse files
segoondavem330
authored andcommitted
net: dccp: fix sign bug
'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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bfc978f commit 8e64159

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/dccp/ackvec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ static inline int dccp_ackvec_set_buf_head_state(struct dccp_ackvec *av,
201201
const unsigned int packets,
202202
const unsigned char state)
203203
{
204-
unsigned int gap;
204+
long gap;
205205
long new_head;
206206

207207
if (av->av_vec_len + packets > DCCP_MAX_ACKVEC_LEN)

0 commit comments

Comments
 (0)