On 15.04.2025 14:49, Teddy Astie wrote: > UBSAN complains when trying memcpy with a NULL pointer even if it's going to > copy zero bytes (which are the only cases where a NULL pointer is used).
If this really was a problem, I think we'd need to go through and find all instances. However, ... > Fix this by only doing the memcpy if the pointer is non-NULL. > > (XEN) > ================================================================================ > (XEN) UBSAN: Undefined behaviour in arch/x86/mm/shadow/hvm.c:168:5 > (XEN) null pointer passed as argument 1, declared with nonnull attribute ... it can only be the compiler who has added the nonnull attribute; we use it only in very few (other) places. Personally I find it absurd to forbid NULL here when the size is zero. Yet I agree that the spec can be interpreted this way. Jan