cpu_ioreq_pio, cpu_ioreq_move: i should be uint32_t rather than int
authorIan Jackson <ian.jackson@eu.citrix.com>
Mon, 17 Dec 2012 11:44:02 +0000 (11:44 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Mon, 17 Dec 2012 11:44:02 +0000 (11:44 +0000)
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.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Dongxiao Xu <dongxiao.xu@intel.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
xen-all.c

index ef430ca21e85a5b3915dece5639e503ffbe8b90a..daf43b99d00db4ea64d9b8588ec401d092f6f1ea 100644 (file)
--- 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) {