From: Roel Kluin <roel.kluin@gmail.com>
To: paul.moore@hp.com
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] cipso: subtraction on unsigned hdr_delta
Date: Tue, 03 Mar 2009 23:23:38 +0100 [thread overview]
Message-ID: <49ADADEA.8090306@gmail.com> (raw)
hdr_delta is unsigned, so take care not to subtract below 0.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
index 7bc9929..b1d862b 100644
--- a/net/ipv4/cipso_ipv4.c
+++ b/net/ipv4/cipso_ipv4.c
@@ -1999,7 +1999,11 @@ void cipso_v4_sock_delattr(struct sock *sk)
iter++;
hdr_delta = opt->optlen;
opt->optlen = (optlen_new + 3) & ~3;
- hdr_delta -= opt->optlen;
+
+ if (hdr_delta > opt->optlen)
+ hdr_delta -= opt->optlen;
+ else
+ hdr_delta = 0;
} else {
/* only the cipso option was present on the socket so we can
* remove the entire option struct */
next reply other threads:[~2009-03-03 22:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-03 22:23 Roel Kluin [this message]
2009-03-04 7:42 ` [PATCH] cipso: subtraction on unsigned hdr_delta David Miller
2009-03-04 17:25 ` Paul Moore
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=49ADADEA.8090306@gmail.com \
--to=roel.kluin@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=paul.moore@hp.com \
/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.