Thread (4 messages) 4 messages, 3 authors, 2015-02-20

smsc95xx truesize badness

flat view

From: Steve Glendinning <hidden>
Date: 2015-02-19 18:58:42

Hi all,

It seems smsc95xx is doing bad things with truesize in our receive loop.

Simplified loop with some bits removed for clarity (handles the
possible case of receiving multiple frames in one USB transaction):


while (skb->len > 0) {

    /* last frame in this batch */
    if (skb->len == size) {
        skb_trim(skb, skb->len - 4); /* remove fcs */
        skb->truesize = size + sizeof(struct sk_buff);
        return 1;
    }

    ax_skb = skb_clone(skb, GFP_ATOMIC);
    if (unlikely(!ax_skb)) {
        netdev_warn(dev->net, "Error allocating skb\n");
        return 0;
    }

    ax_skb->len = size;
    ax_skb->data = packet;
    skb_set_tail_pointer(ax_skb, size);
    skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */
    ax_skb->truesize = size + sizeof(struct sk_buff);

    usbnet_skb_return(dev, ax_skb);
}


This is triggering warnings for many Raspberry Pi users due to Eric's
patch to catch truesize offenders.  It's a fair cop.

Before I submit a patch to remove these two truesize lines, I believe
it's safe to just do so but can anyone confirm if removing them will
have any adverse impact?

Thanks!
-- 
Steve Glendinning
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help