From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Stabellini Subject: Re: [PATCH v2] x86/HVM: avoid pointer wraparound in bufioreq handling Date: Wed, 22 Jul 2015 16:45:24 +0100 Message-ID: References: <5582E0660200007800086A27@mail.emea.novell.com> <55AFB8DB0200007800094131@prv-mh.provo.novell.com> <55AFD1230200007800094251@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZHwEA-0003Tu-3s for xen-devel@lists.xenproject.org; Wed, 22 Jul 2015 15:46:38 +0000 In-Reply-To: <55AFD1230200007800094251@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Wei Liu , Stefano Stabellini , Andrew Cooper , Ian Jackson , TimDeegan , Ian Campbell , xen-devel , Keir Fraser List-Id: xen-devel@lists.xenproject.org On Wed, 22 Jul 2015, Jan Beulich wrote: > >>> On 22.07.15 at 16:49, wrote: > > On Wed, 22 Jul 2015, Jan Beulich wrote: > >> >>> On 21.07.15 at 18:18, 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.