diff options
author | Stefan Weil <weil@mail.berlios.de> | 2009-11-19 19:44:55 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-12-03 15:25:58 -0600 |
commit | b10fec9bfac17e932f630d341180d04be97074bc (patch) | |
tree | 5615d80356cecbfc0eb02b568377743b899d9e26 | |
parent | 53ea95de527f146d902aaf442625e0fe6dd25524 (diff) | |
download | qemu-b10fec9bfac17e932f630d341180d04be97074bc.tar.gz qemu-b10fec9bfac17e932f630d341180d04be97074bc.tar.bz2 qemu-b10fec9bfac17e932f630d341180d04be97074bc.zip |
e1000: Fix warning from code review
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>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r-- | hw/e1000.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/e1000.c b/hw/e1000.c index b65a74fe9e..8566fe3276 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->nic->nc, tp->vlan, tp->size + 4); } else |