[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1411063655.4290.18.camel@joe-AO725>
Date: Thu, 18 Sep 2014 11:07:35 -0700
From: Joe Perches <joe@...ches.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: Stephen Hemminger <stephen@...workplumber.org>,
Or Gerlitz <or.gerlitz@...il.com>,
Govindarajulu Varadarajan <_govind@....com>,
Yinghai Lu <yinghai@...nel.org>,
David Miller <davem@...emloft.net>,
NetDev <netdev@...r.kernel.org>, ssujith@...co.com,
gvaradar@...co.com, "Christian Benvenuti (benve)" <benve@...co.com>
Subject: Re: [PATCH net] net: sched: shrink struct qdisc_skb_cb to 28 bytes
On Thu, 2014-09-18 at 11:00 -0700, Eric Dumazet wrote:
> On Thu, 2014-09-18 at 09:32 -0700, Eric Dumazet wrote:
> > On Thu, 2014-09-18 at 09:26 -0700, Stephen Hemminger wrote:
[]
> > 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.
[]
> 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 *
> diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> @@ -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);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists