Thread (36 messages) flat view 36 messages, 12 authors, 2014-09-22

Re: [PATCH net] net: sched: shrink struct qdisc_skb_cb to 28 bytes

From: Joe Perches <joe@perches.com>
Date: 2014-09-18 18:07:39

On Thu, 2014-09-18 at 11:00 -0700, Eric Dumazet wrote:
On Thu, 2014-09-18 at 09:32 -0700, Eric Dumazet wrote:
quoted
On Thu, 2014-09-18 at 09:26 -0700, Stephen Hemminger wrote:
[]
quoted
Or, do you have an idea ?
Seems straightforward ...

Or can you carry this fix for me ?

Thanks

[PATCH] ipoib: validate struct ipoib_cb size

To catch future errors sooner.
[]
quoted hunk ↗ jump to hunk
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
[]
+static inline struct ipoib_cb *ipoib_skb_cb(const struct sk_buff *skb)
+{
+	BUILD_BUG_ON(sizeof(skb->cb) < sizeof(struct ipoib_cb));
+	return (struct ipoib_cb *)skb->cb;
+}
It seems better not to use const for the struct sk_buff * here.

Neither of the uses take a const struct sk_buff *
quoted hunk ↗ jump to hunk
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
quoted hunk ↗ jump to hunk
@@ -716,7 +716,7 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct ipoib_dev_priv *priv = netdev_priv(dev);
 	struct ipoib_neigh *neigh;
-	struct ipoib_cb *cb = (struct ipoib_cb *) skb->cb;
+	struct ipoib_cb *cb = ipoib_skb_cb(skb);
 	struct ipoib_header *header;
 	unsigned long flags;
 
@@ -813,7 +813,7 @@ static int ipoib_hard_header(struct sk_buff *skb,
 			     const void *daddr, const void *saddr, unsigned len)
 {
 	struct ipoib_header *header;
-	struct ipoib_cb *cb = (struct ipoib_cb *) skb->cb;
+	struct ipoib_cb *cb = ipoib_skb_cb(skb);
 
 	header = (struct ipoib_header *) skb_push(skb, sizeof *header);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help