From: dave rientjes <[EMAIL PROTECTED]>

The size of struct nc_trailer is inherently the newtailroom pad.


Signed-off-by: David Rientjes <[EMAIL PROTECTED]>
Cc: David Brownell <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/usb/net/net1080.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/net/net1080.c b/drivers/usb/net/net1080.c
index a9b6eea..301baa7 100644
--- a/drivers/usb/net/net1080.c
+++ b/drivers/usb/net/net1080.c
@@ -498,25 +498,24 @@ #endif
 static struct sk_buff *
 net1080_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
 {
-       int                     padlen;
        struct sk_buff          *skb2;
        struct nc_header        *header = NULL;
        struct nc_trailer       *trailer = NULL;
+       int                     padlen = sizeof (struct nc_trailer);
        int                     len = skb->len;
 
-       padlen = ((len + sizeof (struct nc_header)
-                       + sizeof (struct nc_trailer)) & 0x01) ? 0 : 1;
+       if (!((len + padlen + sizeof (struct nc_header)) & 0x01))
+               padlen++;
        if (!skb_cloned(skb)) {
                int     headroom = skb_headroom(skb);
                int     tailroom = skb_tailroom(skb);
 
-               if ((padlen + sizeof (struct nc_trailer)) <= tailroom
-                           && sizeof (struct nc_header) <= headroom)
+               if (padlen <= tailroom &&
+                   sizeof(struct nc_header) <= headroom)
                        /* There's enough head and tail room */
                        goto encapsulate;
 
-               if ((sizeof (struct nc_header) + padlen
-                                       + sizeof (struct nc_trailer)) <
+               if ((sizeof (struct nc_header) + padlen) <
                                (headroom + tailroom)) {
                        /* There's enough total room, so just readjust */
                        skb->data = memmove(skb->head
@@ -530,7 +529,7 @@ net1080_tx_fixup(struct usbnet *dev, str
        /* Create a new skb to use with the correct size */
        skb2 = skb_copy_expand(skb,
                                sizeof (struct nc_header),
-                               sizeof (struct nc_trailer) + padlen,
+                               padlen,
                                flags);
        dev_kfree_skb_any(skb);
        if (!skb2)
-- 
1.4.2.1


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to