From: Stefan Weil <weil@mail.berlios.de>
To: kwolf@redhat.com, QEMU Developers <qemu-devel@nongnu.org>,
sgrubb@redhat.com
Subject: [Qemu-devel] [PATCH] e1000: Fix warning from code review
Date: Thu, 19 Nov 2009 19:44:55 +0100 [thread overview]
Message-ID: <1258656295-5688-1-git-send-email-weil@mail.berlios.de> (raw)
In-Reply-To: <200911191311.56137.sgrubb@redhat.com>
A code review run by Steve Grubb complained about code in e1000.c:
In hw/e1000.c at line 89, vlan is declared to be 4 bytes.
At line 382 is an attempt to do a memmove over it with a size of 12.
This was fixed by splitting the memmove in two calls and
adding a comment to the declaration of vlan and data.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
hw/e1000.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/hw/e1000.c b/hw/e1000.c
index 00f6a57..6f9adb5 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -89,6 +89,7 @@ typedef struct E1000State_st {
struct e1000_tx {
unsigned char header[256];
unsigned char vlan_header[4];
+ /* Fields vlan and data must not be reordered or separated. */
unsigned char vlan[4];
unsigned char data[0x10000];
uint16_t size;
@@ -383,7 +384,8 @@ xmit_seg(E1000State *s)
if (tp->sum_needed & E1000_TXD_POPTS_IXSM)
putsum(tp->data, tp->size, tp->ipcso, tp->ipcss, tp->ipcse);
if (tp->vlan_needed) {
- memmove(tp->vlan, tp->data, 12);
+ memmove(tp->vlan, tp->data, 4);
+ memmove(tp->data, tp->data + 4, 8);
memcpy(tp->data + 8, tp->vlan_header, 4);
qemu_send_packet(s->vc, tp->vlan, tp->size + 4);
} else
--
1.5.6.5
next prev parent reply other threads:[~2009-11-19 18:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-18 11:39 [Qemu-devel] Fwd: qemu code review Kevin Wolf
2009-11-18 16:34 ` malc
2009-11-18 18:43 ` Blue Swirl
2009-11-18 19:06 ` Stefan Weil
2009-11-19 9:09 ` Kevin Wolf
2009-11-19 18:11 ` Steve Grubb
2009-11-19 18:44 ` Stefan Weil [this message]
2009-11-19 20:16 ` [Qemu-devel] [PATCH] e1000: Fix warning from " Ian Molton
2009-11-23 10:44 ` [Qemu-devel] Fwd: qemu " Daniel P. Berrange
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=1258656295-5688-1-git-send-email-weil@mail.berlios.de \
--to=weil@mail.berlios.de \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sgrubb@redhat.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).