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

Re: [Xen-devel] [PATCH V2] libxl/xl: implement support for guest iooprt and irq permissions



On Fri, 2012-08-31 at 17:01 +0100, Ian Jackson wrote:
> Ian Campbell writes ("[PATCH V2] libxl/xl: implement support for guest iooprt 
> and irq permissions"):
> > libxl/xl: implement support for guest iooprt and irq permissions.
> ...> 
> > -    int e;
> > +    int i, e;
> ...
> > +            ul = strtoul(buf, &ep, 16);
> > +            if (ep == buf) {
> > +                fprintf(stderr, "xl: Invalid argument parsing ioport: 
> > %s\n",
> > +                        buf);
> > +                exit(1);
> > +            }
> > +            if (ul > UINT32_MAX) {
> > +                fprintf(stderr, "xl: ioport %lx too big\n", ul);
> > +                exit(1);
> > +            }
> 
> 1. If long and int are the same size, this still mishandles
> "1100000055\0", passing -1 to libxl.
> 
> 2. You compare to UINT32_MAX and then assign to a signed integer.
> That seems odd.

Everything here is signed now.

Oh, I see the confusion, I've unwittingly shadowed the e you've quoted
with an uint32_t in this scope. I'll change the variable name since that
obviously not helpful.

Ian.



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


 


Rackspace

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