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

Re: [Xen-devel] [PATCH v2] x86/HVM: avoid pointer wraparound in bufioreq handling



On Wed, 22 Jul 2015, Jan Beulich wrote:
> >>> On 22.07.15 at 16:49, <stefano.stabellini@xxxxxxxxxxxxx> wrote:
> > On Wed, 22 Jul 2015, Jan Beulich wrote:
> >> >>> On 21.07.15 at 18:18, <stefano.stabellini@xxxxxxxxxxxxx> wrote:
> >> > On Thu, 18 Jun 2015, Jan Beulich wrote:
> >> >> --- a/xen/arch/x86/hvm/hvm.c
> >> >> +++ b/xen/arch/x86/hvm/hvm.c
> >> >> @@ -921,7 +921,7 @@ static void hvm_ioreq_server_disable(str
> >> >>  
> >> >>  static int hvm_ioreq_server_init(struct hvm_ioreq_server *s, struct 
> >> >> domain *d,
> >> >>                                   domid_t domid, bool_t is_default,
> >> >> -                                 bool_t handle_bufioreq, ioservid_t id)
> >> >> +                                 int bufioreq_handling, ioservid_t id)
> >> > 
> >> > uint8_t?
> >> 
> >> Why? I'm generally against using fixed width types when you don't
> >> really need them. And using uint_least8_t or uint_fast8_t is neither
> >> an opton, nor would it make the code look reasonable. Plain int is
> >> just fine here.
> > 
> > You are not just changing integer size but also switching from unsigned
> > to signed implicitly. I think it is not a good coding practice.
> 
> To me bool (and by implication bool_t) is neither a signed nor
> an unsigned type.

I meant that handle_bufioreq, a uint8_t, is actually transparently
passed to hvm_create_ioreq_server, that takes an int as argument.
I think it should be avoided, or casted explicitly to avoid confusion
in the future.

_______________________________________________
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®.