qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ian Jackson <ian.jackson@eu.citrix.com>
To: qemu-devel@nongnu.org, xen-devel@lists.xensource.com
Cc: Dongxiao Xu <dongxiao.xu@intel.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [Qemu-devel] [PATCH 2/2] cpu_ioreq_pio, cpu_ioreq_move: i should be uint32_t rather than int
Date: Mon, 10 Dec 2012 18:04:23 +0000	[thread overview]
Message-ID: <1355162663-26956-3-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1355162663-26956-1-git-send-email-ian.jackson@eu.citrix.com>

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 |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen-all.c b/xen-all.c
index 97c8ef4..aabbb80 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -717,7 +717,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) {
@@ -746,7 +746,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) {
-- 
1.7.2.5

      parent reply	other threads:[~2012-12-10 18:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-10 18:04 [Qemu-devel] [PATCH 0/2] cpu_ioreq_pio, cpu_ioreq_move: simply and fix Ian Jackson
2012-12-10 18:04 ` [Qemu-devel] [PATCH 1/2] cpu_ioreq_pio, cpu_ioreq_move: introduce read_phys_req_item, write_phys_req_item Ian Jackson
2012-12-10 19:29   ` Stefano Stabellini
2012-12-10 18:04 ` Ian Jackson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1355162663-26956-3-git-send-email-ian.jackson@eu.citrix.com \
    --to=ian.jackson@eu.citrix.com \
    --cc=dongxiao.xu@intel.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).