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

From: Mike Rapoport

Date: Mon Jun 22 2026 - 15:15:33 EST


On Mon, 22 Jun 2026 11:12:14 +0000, Tarun Sahu <tarunsahu@xxxxxxxxxx> 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.