From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: dongxiao.xu@intel.com, Ian.Jackson@eu.citrix.com,
qemu-devel@nongnu.org,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH 1/2] i should be uint32_t rather than int
Date: Mon, 10 Sep 2012 19:06:22 +0100 [thread overview]
Message-ID: <1347300383-9089-1-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1209101842150.15568@kaball.uk.xensource.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>
---
i386-dm/helper2.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/i386-dm/helper2.c b/i386-dm/helper2.c
index c6d049c..8f2a893 100644
--- a/i386-dm/helper2.c
+++ b/i386-dm/helper2.c
@@ -351,7 +351,8 @@ static inline void write_physical(uint64_t addr, unsigned long size, void *val)
static void cpu_ioreq_pio(CPUState *env, ioreq_t *req)
{
- int i, sign;
+ uint32_t i;
+ int sign;
sign = req->df ? -1 : 1;
@@ -386,7 +387,8 @@ static void cpu_ioreq_pio(CPUState *env, ioreq_t *req)
static void cpu_ioreq_move(CPUState *env, ioreq_t *req)
{
- int i, sign;
+ uint32_t i;
+ int sign;
sign = req->df ? -1 : 1;
--
1.7.2.5
next prev parent reply other threads:[~2012-09-10 18:06 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-10 18:04 [PATCH 0/2] QEMU/xen: simplify cpu_ioreq_pio and cpu_ioreq_move Stefano Stabellini
2012-09-10 18:06 ` Stefano Stabellini [this message]
2012-09-10 18:06 ` [PATCH 2/2] introduce read_physical_offset and write_physical_offset Stefano Stabellini
2012-09-17 23:18 ` [PATCH 0/2] QEMU/xen: simplify cpu_ioreq_pio and cpu_ioreq_move Xu, Dongxiao
2012-09-18 10:24 ` Stefano Stabellini
2012-11-29 3:22 ` Xu, Dongxiao
2012-11-29 13:21 ` Stefano Stabellini
2012-11-29 13:57 ` [Xen-devel] " Ian Campbell
2012-11-29 15:10 ` Pasi Kärkkäinen
2012-12-07 16:14 ` [Xen-devel] " Ian Jackson
2012-12-07 16:30 ` Ian Campbell
2012-12-07 16:33 ` [Xen-devel] " Ian Jackson
2012-12-11 5:50 ` Xu, Dongxiao
2013-01-08 1:49 ` Xu, Dongxiao
2013-01-09 7:09 ` Pasi Kärkkäinen
2013-01-24 13:44 ` [Xen-devel] [PATCH 0/2] QEMU/xen: simplify cpu_ioreq_pio and cpu_ioreq_move / Xen on Xen nested virt Pasi Kärkkäinen
2013-01-31 2:23 ` Xu, Dongxiao
2013-02-19 19:38 ` Pasi Kärkkäinen
2013-02-20 15:42 ` Ian Jackson
2013-02-20 15:53 ` Pasi Kärkkäinen
2012-12-10 16:08 ` [Xen-devel] [PATCH 0/2] QEMU/xen: simplify cpu_ioreq_pio and cpu_ioreq_move Stefano Stabellini
2012-12-10 17:01 ` Ian Jackson
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=1347300383-9089-1-git-send-email-stefano.stabellini@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=dongxiao.xu@intel.com \
--cc=qemu-devel@nongnu.org \
--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).