[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH for-4.10] libxl: handle NULL in libxl__enum_from_string
On Fri, Oct 13, 2017 at 01:46:57PM +0100, Ian Jackson wrote: > Wei Liu writes ("[PATCH for-4.10] libxl: handle NULL in > libxl__enum_from_string"): > > Discovered by Coverity. > > But. Surely it is very wrong > > > @@ -1017,7 +1017,7 @@ int libxl_get_max_nodes(libxl_ctx *ctx) > > int libxl__enum_from_string(const libxl_enum_string_table *t, > > const char *s, int *e) > > { > > - if (!t) return ERROR_INVAL; > > + if (!t || !s) return ERROR_INVAL; > > to call this function with s==NULL. > > I'm not generally in favour of turning such mistakes from > easy-to-debug crashes into hard-to-track-down error codes (especially > with our nonspecific error codes). > > Where does that occur ? > libxl_*_type_from_string. I agree they shouldn't be called with NULL. We should guard against error (here or the libxl_*_type_from_string) or annotate the input can't be NULL. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |