From: Stefan Weil <sw@weilnetz.de>
To: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
Cc: qemu-trivial@nongnu.org, Stefan Weil <sw@weilnetz.de>,
qemu-devel@nongnu.org
Subject: [Qemu-trivial] [PATCH] cadence_uart: Fix buffer overflow
Date: Sat, 1 Sep 2012 11:12:23 +0200 [thread overview]
Message-ID: <1346490743-9652-1-git-send-email-sw@weilnetz.de> (raw)
Report from smatch:
hw/cadence_uart.c:413 uart_read(13) error: buffer overflow 's->r' 18 <= 18
This fixes read access to s->r[R_MAX] which is behind the limits of s->r.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
hw/cadence_uart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/cadence_uart.c b/hw/cadence_uart.c
index d98e531..f8afc4e 100644
--- a/hw/cadence_uart.c
+++ b/hw/cadence_uart.c
@@ -404,7 +404,7 @@ static uint64_t uart_read(void *opaque, target_phys_addr_t offset,
uint32_t c = 0;
offset >>= 2;
- if (offset > R_MAX) {
+ if (offset >= R_MAX) {
return 0;
} else if (offset == R_TX_RX) {
uart_read_rx_fifo(s, &c);
--
1.7.10
next reply other threads:[~2012-09-01 9:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-01 9:12 Stefan Weil [this message]
2012-09-04 4:40 ` [Qemu-trivial] [PATCH] cadence_uart: Fix buffer overflow Peter Crosthwaite
2012-09-22 15:30 ` Stefan Hajnoczi
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=1346490743-9652-1-git-send-email-sw@weilnetz.de \
--to=sw@weilnetz.de \
--cc=peter.crosthwaite@petalogix.com \
--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).