On Wed, 2015-12-09 at 12:22 +0000, Wei Liu wrote:
> > diff --git a/tools/libs/foreignmemory/core.c
> > b/tools/libs/foreignmemory/core.c
> > index 21dc7ee..91bea55 100644
> > --- a/tools/libs/foreignmemory/core.c
> > +++ b/tools/libs/foreignmemory/core.c
> > @@ -14,6 +14,8 @@
> >   */
> >  
> >  #include <stdlib.h>
> > +#include <assert.h>
> > +#include <errno.h>
> >  
> >  #include "private.h"
> >  
> > @@ -64,7 +66,33 @@ void *xenforeignmemory_map(xenforeignmemory_handle
> > *fmem,
> >                             uint32_t dom, int prot,
> >                             const xen_pfn_t *arr, int *err, size_t num)
> >  {
> > -    return osdep_xenforeignmemory_map(fmem, dom, prot, arr, err, num);
> > +    void *ret;
> > +    int *err_to_free = NULL;
> > +
> > +    if ( err == NULL )
> > +        err = err_to_free = malloc(num * sizeof(int));
> > +
> 
> malloc can fail, which means when user passes in err==NULL there is two
> possible behaviours of this function?

Partially/Full success and "fail entirely reporting an error" you mean?
There are always those two possibilities, yes, regardless of err==NULL. I
think that's inline with the doc comment too.

If that's not what you were asking then I'm afraid I don't see what you are
getting at.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to