# Re: \[PATCH bpf-next v2 2/6\] net: tun: enable transfer of XDP metadata to skb

- From: Marcus Wichelmann \<hidden\>
- Date: 2025-02-19 15:15:34 
- List: netdev
- Page: https://ratatoskr.run/netdev/2025/02/2933901
- Thread: https://ratatoskr.run/netdev/2025/02/2930329/t.md

```text
Am 19.02.25 um 16:06 schrieb Willem de Bruijn:
> Marcus Wichelmann wrote:
>> Am 18.02.25 um 02:47 schrieb Willem de Bruijn:
>>> [...]
>>> This is pointer comparison, which is tricky wrt type. It likely is
>>> ptrdiff_t and thus signed. But may want to use max_t(long int, ..) to
>>> make this explicit.
>>
>> Ah, I see, good point.
>>
>> So like that?
>>
>> 	metasize = max_t(long int, xdp->data - xdp->data_meta, 0);
>> 	if (metasize)
>> 		skb_metadata_set(skb, metasize);
>
> Or just this? Also ensures the test uses signed int.
>
>      int metasize;
>
>      ...
>
>
>      metasize = xdp->data - xdp->data_meta;
>      if (metasize > 0)
>              skb_metadata_set(skb, metasize);
>

Well, yeah, just keep it simple I guess. ;) Will do that.

I'll send a V3 patch series with the change.

Thanks!

Marcus
```
