On Wed, 4 Nov 2020 16:48:57 +0100 Andrew Lunn wrote: > - buf = (char*)((u32)skb->data & ~0x3); > - len = (skb->len + 3 + ((u32)skb->data & 3)) & ~0x3; > - cmdA = (((u32)skb->data & 0x3) << 16) | > + offset = (unsigned long)skb->data & 3; > + buf = skb->data - offset; > + len = skb->len + offset; > + cmdA = (offset << 16) |
The len calculation is wrong, you trusted people on the mailing list too much ;) This is better: - len = (skb->len + 3 + ((u32)skb->data & 3)) & ~0x3; + len = round_up(skb->len, 4); You can also do PTR_ALIGN_DOWN() for the skb->data if you want. And give the same treatment to the other side of the #if statement.