diff options
Diffstat (limited to 'drivers/net/wireless/orinoco.c')
-rw-r--r-- | drivers/net/wireless/orinoco.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index 78afbc7f08be..da4c5e94a959 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c | |||
@@ -490,9 +490,14 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
490 | return 0; | 490 | return 0; |
491 | } | 491 | } |
492 | 492 | ||
493 | /* Length of the packet body */ | 493 | /* Check packet length, pad short packets, round up odd length */ |
494 | /* FIXME: what if the skb is smaller than this? */ | 494 | len = max_t(int, ALIGN(skb->len, 2), ETH_ZLEN); |
495 | len = max_t(int,skb->len - ETH_HLEN, ETH_ZLEN - ETH_HLEN); | 495 | if (skb->len < len) { |
496 | skb = skb_padto(skb, len); | ||
497 | if (skb == NULL) | ||
498 | goto fail; | ||
499 | } | ||
500 | len -= ETH_HLEN; | ||
496 | 501 | ||
497 | eh = (struct ethhdr *)skb->data; | 502 | eh = (struct ethhdr *)skb->data; |
498 | 503 | ||
@@ -544,8 +549,7 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
544 | p = skb->data; | 549 | p = skb->data; |
545 | } | 550 | } |
546 | 551 | ||
547 | /* Round up for odd length packets */ | 552 | err = hermes_bap_pwrite(hw, USER_BAP, p, data_len, |
548 | err = hermes_bap_pwrite(hw, USER_BAP, p, ALIGN(data_len, 2), | ||
549 | txfid, data_off); | 553 | txfid, data_off); |
550 | if (err) { | 554 | if (err) { |
551 | printk(KERN_ERR "%s: Error %d writing packet to BAP\n", | 555 | printk(KERN_ERR "%s: Error %d writing packet to BAP\n", |