diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2011-11-17 21:20:04 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-18 14:37:09 -0500 |
commit | ae641949df01b85117845bec45328eab6d6fada1 (patch) | |
tree | ed8d5aedd678f86e8554dc0b1c080a43ef4b331d /net/econet/af_econet.c | |
parent | a7ae1992248e5cf9dc5bd35695ab846d27efe15f (diff) |
net: Remove all uses of LL_ALLOCATED_SPACE
net: Remove all uses of LL_ALLOCATED_SPACE
The macro LL_ALLOCATED_SPACE was ill-conceived. It applies the
alignment to the sum of needed_headroom and needed_tailroom. As
the amount that is then reserved for head room is needed_headroom
with alignment, this means that the tail room left may be too small.
This patch replaces all uses of LL_ALLOCATED_SPACE with the macro
LL_RESERVED_SPACE and direct reference to needed_tailroom.
This also fixes the problem with needed_headroom changing between
allocating the skb and reserving the head room.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/econet/af_econet.c')
-rw-r--r-- | net/econet/af_econet.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index 1c1f26c5d672..7e717cb35ad1 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c | |||
@@ -322,6 +322,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
322 | /* Real hardware Econet. We're not worthy etc. */ | 322 | /* Real hardware Econet. We're not worthy etc. */ |
323 | #ifdef CONFIG_ECONET_NATIVE | 323 | #ifdef CONFIG_ECONET_NATIVE |
324 | unsigned short proto = 0; | 324 | unsigned short proto = 0; |
325 | int hlen, tlen; | ||
325 | int res; | 326 | int res; |
326 | 327 | ||
327 | if (len + 15 > dev->mtu) { | 328 | if (len + 15 > dev->mtu) { |
@@ -331,12 +332,14 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
331 | 332 | ||
332 | dev_hold(dev); | 333 | dev_hold(dev); |
333 | 334 | ||
334 | skb = sock_alloc_send_skb(sk, len + LL_ALLOCATED_SPACE(dev), | 335 | hlen = LL_RESERVED_SPACE(dev); |
336 | tlen = dev->needed_tailroom; | ||
337 | skb = sock_alloc_send_skb(sk, len + hlen + tlen, | ||
335 | msg->msg_flags & MSG_DONTWAIT, &err); | 338 | msg->msg_flags & MSG_DONTWAIT, &err); |
336 | if (skb == NULL) | 339 | if (skb == NULL) |
337 | goto out_unlock; | 340 | goto out_unlock; |
338 | 341 | ||
339 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); | 342 | skb_reserve(skb, hlen); |
340 | skb_reset_network_header(skb); | 343 | skb_reset_network_header(skb); |
341 | 344 | ||
342 | eb = (struct ec_cb *)&skb->cb; | 345 | eb = (struct ec_cb *)&skb->cb; |