Thread (30 messages) 30 messages, 6 authors, 2022-03-14

Re: [PATCH 01/15] skbuff: introduce skb_pull_data

From: Jakub Kicinski <kuba@kernel.org>
Date: 2021-12-01 01:11:11
Also in: linux-bluetooth

On Tue, 30 Nov 2021 16:02:01 -0800 Luiz Augusto von Dentz wrote:
From: Luiz Augusto von Dentz <redacted>

Like skb_pull but returns the original data pointer before pulling the
data after performing a check against sbk->len.

This allows to change code that does "struct foo *p = (void *)skb->data;"
which is hard to audit and error prone, to:

        p = skb_pull_data(skb, sizeof(*p));
        if (!p)
                return;

Which is both safer and cleaner.
It doesn't take a data pointer, so not really analogous to
skb_put_data() and friends which come to mind. But I have 
no better naming suggestions. You will need to respin, tho,
if you want us to apply these directly, the patches as posted 
don't apply to either netdev tree.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help