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

Reply via email to