From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, patches@linaro.org
Subject: [Qemu-devel] [PATCH 1/3] hw/ide/ahci.c: Avoid shift left into sign bit
Date: Fri, 28 Mar 2014 15:12:55 +0000 [thread overview]
Message-ID: <1396019577-2013-2-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1396019577-2013-1-git-send-email-peter.maydell@linaro.org>
Add U suffix to avoid shifting left into the sign bit, which
is undefined behaviour.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/ide/ahci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index bfe633f..50327ff 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -438,9 +438,9 @@ static void check_cmd(AHCIState *s, int port)
if ((pr->cmd & PORT_CMD_START) && pr->cmd_issue) {
for (slot = 0; (slot < 32) && pr->cmd_issue; slot++) {
- if ((pr->cmd_issue & (1 << slot)) &&
+ if ((pr->cmd_issue & (1U << slot)) &&
!handle_cmd(s, port, slot)) {
- pr->cmd_issue &= ~(1 << slot);
+ pr->cmd_issue &= ~(1U << slot);
}
}
}
--
1.9.0
next prev parent reply other threads:[~2014-03-28 15:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-28 15:12 [Qemu-devel] [PATCH 0/3] More fixes for undefined behaviour Peter Maydell
2014-03-28 15:12 ` Peter Maydell [this message]
2014-04-06 7:10 ` [Qemu-devel] [Qemu-trivial] [PATCH 1/3] hw/ide/ahci.c: Avoid shift left into sign bit Michael Tokarev
2014-03-28 15:12 ` [Qemu-devel] [PATCH 2/3] int128.h: Avoid undefined behaviours involving signed arithmetic Peter Maydell
2014-04-06 7:09 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2014-04-06 10:18 ` Peter Maydell
2014-04-06 14:13 ` Michael Tokarev
2014-04-06 14:58 ` Peter Maydell
2014-04-06 15:27 ` Peter Maydell
2014-04-07 14:25 ` Richard Henderson
2014-04-07 14:47 ` Peter Maydell
2014-04-07 15:49 ` Markus Armbruster
2014-04-07 14:56 ` Avi Kivity
2014-04-07 15:17 ` Peter Maydell
2014-04-07 15:22 ` Avi Kivity
2014-03-28 15:12 ` [Qemu-devel] [PATCH 3/3] xbzrle.c: Avoid undefined behaviour with " Peter Maydell
2014-04-06 14:15 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
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=1396019577-2013-2-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=patches@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/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).