From: Igor Russkikh <igor.russk...@aquantia.com>
Date: Wed, 21 Nov 2018 10:13:37 +0000

> +     if (padding_size != 0)
> +             skb_put(skb, padding_size);

I think you want to use skb_put_zero() here rather than leaving it
uninitialized.  I know it's padding, but if for some reason this leaks
onto the wire or elsewhere we'll regret not initializing this buffer.

> +     /* Copy TX header */
> +     skb_push(skb, sizeof(tx_desc));
> +     cpu_to_le64s(&tx_desc);
> +     skb_copy_to_linear_data(skb, &tx_desc, sizeof(tx_desc));

I seriously wonder if, with all of the invariants wrt. length modulus
and padding, that you can safely just go:

        __le64 *p;

        p = skb_push(skb, sizeof(tx_desc));
        *p = cpu_to_le64(tx_desc);

or something like that.
        

Reply via email to