[RESEND PATCH v3 1/2] kho: add KHOSER_COPY_TYPE(UN)SAFE for phys copy

Mike Rapoport rppt at kernel.org
Mon Jun 22 12:15:08 PDT 2026


On Mon, 22 Jun 2026 11:12:14 +0000, Tarun Sahu <tarunsahu at google.com> wrote:
> diff --git a/include/linux/kho/abi/kexec_handover.h b/include/linux/kho/abi/kexec_handover.h
> index 5e2eb8519bda..618408fbe9c9 100644
> --- a/include/linux/kho/abi/kexec_handover.h
> +++ b/include/linux/kho/abi/kexec_handover.h
> @@ -139,6 +139,18 @@
>  		(typeof((s).ptr))((s).phys ? phys_to_virt((s).phys) : NULL); \
>  	})
>  
> +/* Copies one serializable pointer to another of same type. */
> +#define KHOSER_COPY_TYPESAFE(dest, src) \

Maybe name if KHOSER_COPY_PTR?

> +	({ \
> +		typecheck(typeof((dest).ptr), (src).ptr); \

And if we could replace the typecheck with some other magic to allow
void * we won't need the unsafe version.

-- 
Sincerely yours,
Mike.




More information about the kexec mailing list