Skip to contentSkip to conversation

cls_u32: signedness bug

PATCH Applied Dan Carpenter 2 participants 2 messages Oct 4, 2010 – Oct 5, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cls_u32: signedness bug

skb_headroom() is unsigned so "skb_headroom(skb) + toff" is also unsigned and can't be less than zero. This test was added in 66d50d25:
"u32: negative offset fix" It was supposed to fix a regression.

---
Compile tested only. Please check.

net/sched/cls_u32.c +1 -1
index 7416a5c..b0c2a82 100644
@@ -137,7 +137,7 @@ next_knode:
 			int toff = off + key->off + (off2 & key->offmask);
 			__be32 *data, _data;
 
-			if (skb_headroom(skb) + toff < 0)
+			if (skb_headroom(skb) + toff > INT_MAX)
 				goto out;
 
 			data = skb_header_pointer(skb, toff, 4, &_data);
maintainer Applied
#1 lore raw

From: Dan Carpenter <[email protected]>
Date: Mon, 4 Oct 2010 14:28:36 +0200

Quoted 7 lines

skb_headroom() is unsigned so "skb_headroom(skb) + toff" is also unsigned and can't be less than zero. This test was added in 66d50d25:
"u32: negative offset fix" It was supposed to fix a regression.

---
Compile tested only. Please check.

This looks correct to me, thanks for fixing this.

Applied.