Re: [PATCH net] drivers/net/wan: lapb: Replace the skb->len checks with pskb_may_pull

From: David Miller
Date: Sun Oct 04 2020 - 18:15:42 EST


From: Xie He <xie.he.0141@xxxxxxxxx>
Date: Sat, 3 Oct 2020 17:46:19 -0700

> The purpose of these skb->len checks in these drivers is to ensure that
> there is a header in the skb available to be read and pulled.
>
> However, we already have the pskb_may_pull function for this purpose.
>
> The pskb_may_pull function also correctly handles non-linear skbs.
>
> (Also delete the word "check" in the comments because pskb_may_pull may
> do things other than simple checks in the case of non-linear skbs.)
>
> Cc: Willem de Bruijn <willemdebruijn.kernel@xxxxxxxxx>
> Cc: Martin Schiller <ms@xxxxxxxxxx>
> Signed-off-by: Xie He <xie.he.0141@xxxxxxxxx>

This is excessive.

On transmit the header will be in the linear area, especially
if it is only one byte in size.

You're adding a lot of extra checks, function calls, etc. which are
frankly unnecessary.

I'm not applying this unless you can prove that a non-linear single
header byte is possible in these code paths. And you'll need to add
such proof to your commit message.

Thank you.