On Wed, 17 Nov 2021 01:12:41 +0100 Lorenzo Bianconi wrote: > ack, you are right. Sorry for the issue. > I did not trigger the problem with xdp-mb self-tests since we will not run > bpf_xdp_copy_buf() in this specific case, but just the memcpy() > (but what you reported is a bug and must be fixed). I will add more > self-tests. > Moreover, reviewing the code I guess we can just update bpf_xdp_copy() for our case. > Something like: Seems reasonable. We could probably play some tricks with double pointers to avoid the ternary operator being re-evaluated for each chunk. But even if it's faster it is probably not worth the ugliness of the code.