All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roel Kluin <roel.kluin@gmail.com>
To: dccp@vger.kernel.org
Subject: [PATCH] dccp: ensure gap does not become unsigned -1
Date: Tue, 03 Mar 2009 20:24:55 +0000	[thread overview]
Message-ID: <49AD9217.8020206@gmail.com> (raw)

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) {

             reply	other threads:[~2009-03-03 20:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-03 20:24 Roel Kluin [this message]
2009-03-04 11:45 ` [PATCH] dccp: ensure gap does not become unsigned -1 gerrit
2009-03-04 11:45   ` gerrit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49AD9217.8020206@gmail.com \
    --to=roel.kluin@gmail.com \
    --cc=dccp@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.