[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v2 1/1] tools/libxl: search PATH for QEMU if `QEMU_XEN_PATH` is not absolute



On Tue, Apr 08, 2025 at 12:38:16PM +0200, Jan Beulich wrote:
> On 30.03.2025 18:03, Hongbo wrote:
> > +                {
> > +                    char *path_dup = libxl__strdup(gc, path_env);
> > +                    char *saveptr;
> > +
> > +                    char *path = strtok_r(path_dup, ":", &saveptr);
> 
> Main reason I'm replying here is this one though, where CI found gcc to
> object:
> 
> libxl_dm.c: In function 'libxl__domain_device_model':
> libxl_dm.c:356:31: error: 'saveptr' may be used uninitialized in this 
> function [-Werror=maybe-uninitialized]
>                          char *candidate = libxl__abs_path(gc, configured_dm, 
> path);
>                                ^
> cc1: all warnings being treated as errors
> 
> The compiler can't know that path_dup is guaranteed non-NULL. Hence, if it
> can see (part of) the implementation of strtok_r(), it would observe that
> it's possible that the continuation-invocation path is taken, where
> saveptr necessarily is consumed.

I'll recommit this patch again with `saveptr` initialised to NULL. My
man page says some implementation requires this anyway.

Cheers,

-- 
Anthony PERARD



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.