[PATCH] xen: Handle malloc failure in errmsg function

Simon Glass sjg at chromium.org
Wed Apr 22 03:15:29 CEST 2026


Hi Francois,

On 2026-04-20T19:15:24, Francois Berder <fberder at outlook.fr> wrote:
> xen: Handle malloc failure in errmsg function
>
> Signed-off-by: Francois Berder <fberder at outlook.fr>
>
> drivers/xen/xenbus.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

> diff --git a/drivers/xen/xenbus.c b/drivers/xen/xenbus.c
> @@ -280,12 +280,18 @@ static char *errmsg(struct xsd_sockmsg *rep)
> +             if (!res)
> +                     return NULL;

Callers like xenbus_ls() check 'if (msg)' to detect an error, so NULL
indicates success. With this change, malloc failure returns NULL,
which callers will interpret as success and continue processing.

Maybe return a static string like "Out of memory" when malloc() fails?

Regards,
Simon


More information about the U-Boot mailing list