From: Ian Jackson Date: Mon, 17 Dec 2012 11:44:02 +0000 (+0000) Subject: cpu_ioreq_pio, cpu_ioreq_move: i should be uint32_t rather than int X-Git-Tag: qemu-xen-4.3.0-rc1~12 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=ff780138eab9c89f9c339230ac73e4378ec9efde;p=qemu-upstream-4.6-testing.git cpu_ioreq_pio, cpu_ioreq_move: i should be uint32_t rather than int The current code compare i (int) with req->count (uint32_t) in a for loop, risking an infinite loop if req->count is equal to UINT_MAX. Also i is only used in comparisons or multiplications with unsigned integers. upstream-commit-id: 249e7e0fff080df0eff54730f3b6459d92d61e5a Signed-off-by: Stefano Stabellini Cc: Dongxiao Xu Cc: Stefano Stabellini Signed-off-by: Ian Jackson --- diff --git a/xen-all.c b/xen-all.c index ef430ca21..daf43b99d 100644 --- a/xen-all.c +++ b/xen-all.c @@ -721,7 +721,7 @@ static inline void write_phys_req_item(hwaddr addr, static void cpu_ioreq_pio(ioreq_t *req) { - int i; + uint32_t i; if (req->dir == IOREQ_READ) { if (!req->data_is_ptr) { @@ -750,7 +750,7 @@ static void cpu_ioreq_pio(ioreq_t *req) static void cpu_ioreq_move(ioreq_t *req) { - int i; + uint32_t i; if (!req->data_is_ptr) { if (req->dir == IOREQ_READ) {