WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

Re: [XenPPC] [xenppc-unstable] [ppc] Handle 2 forms of NULL gues handle

On Thu, 2006-07-27 at 18:10 -0400, Jimi Xenidis wrote:
> On Jul 27, 2006, at 5:13 PM, Hollis Blanchard wrote:
> >
> > diff -r 72c8bc5d88f4 drivers/xen/core/xencomm.c
> > --- a/drivers/xen/core/xencomm.c        Thu Jun 29 13:04:30 2006 -0400
> > +++ b/drivers/xen/core/xencomm.c        Thu Jul 27 15:58:58 2006 -0500
> > @@ -58,6 +58,10 @@ static int __xencomm_init(struct xencomm
> >  {
> >         unsigned long recorded = 0;
> >         int i = 0;
> > +
> > +       /* special-case NULL pointers for easy detection on the Xen  
> > side */
> > +       if (buffer == NULL)
> > +               desc->nr_addrs = 0;
> >
> >         /* record the physical pages used */
> >         while ((recorded < bytes) && (i < desc->nr_addrs)) {
> >
> 
> not so simple because 'bytes' is non-zero and we'll end up reporting  
> ENOSPC.

It is a caller error to pass a NULL pointer and claim it holds >0 bytes.
If this is a recurring problem we should add
        BUG_ON((buffer == NULL) && (bytes != 0));

-- 
Hollis Blanchard
IBM Linux Technology Center


_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel