All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dccp: ensure gap does not become unsigned -1
@ 2009-03-03 20:24 Roel Kluin
  2009-03-04 11:45   ` gerrit
  0 siblings, 1 reply; 3+ messages in thread
From: Roel Kluin @ 2009-03-03 20:24 UTC (permalink / raw)
  To: dccp

Is this maybe necessary?
------------------------------>8-------------8<---------------------------------
if packets is 0, becomes -1, but since gap is unsigned, the test 'gap > 0' does
not work.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/net/dccp/ackvec.c b/net/dccp/ackvec.c
index 01e4d39..7c61bc0 100644
--- a/net/dccp/ackvec.c
+++ b/net/dccp/ackvec.c
@@ -207,7 +207,11 @@ static inline int dccp_ackvec_set_buf_head_state(struct dccp_ackvec *av,
 	if (av->av_vec_len + packets > DCCP_MAX_ACKVEC_LEN)
 		return -ENOBUFS;
 
-	gap	 = packets - 1;
+	if (packets > 0)
+		gap = packets - 1;
+	else
+		gap = 0;
+
 	new_head = av->av_buf_head - packets;
 
 	if (new_head < 0) {

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-03-04 11:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-03 20:24 [PATCH] dccp: ensure gap does not become unsigned -1 Roel Kluin
2009-03-04 11:45 ` gerrit
2009-03-04 11:45   ` gerrit

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.