From patchwork Thu Nov 19 18:44:55 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 38865 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3EF57B6F1A for ; Fri, 20 Nov 2009 05:46:01 +1100 (EST) Received: from localhost ([127.0.0.1]:58555 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NBC10-00043L-WA for incoming@patchwork.ozlabs.org; Thu, 19 Nov 2009 13:45:59 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NBC0W-000432-1k for qemu-devel@nongnu.org; Thu, 19 Nov 2009 13:45:28 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NBC0Q-00042W-Iw for qemu-devel@nongnu.org; Thu, 19 Nov 2009 13:45:26 -0500 Received: from [199.232.76.173] (port=33968 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NBC0Q-00042L-C7 for qemu-devel@nongnu.org; Thu, 19 Nov 2009 13:45:22 -0500 Received: from moutng.kundenserver.de ([212.227.17.9]:63180) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NBC0N-0001Ee-SV for qemu-devel@nongnu.org; Thu, 19 Nov 2009 13:45:20 -0500 Received: from flocke.weilnetz.de (p54ADD039.dip.t-dialin.net [84.173.208.57]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0MXmnn-1NfFs7251r-00WE7h; Thu, 19 Nov 2009 19:44:58 +0100 Received: from stefan by flocke.weilnetz.de with local (Exim 4.69) (envelope-from ) id 1NBBzz-0001UB-EJ; Thu, 19 Nov 2009 19:44:55 +0100 From: Stefan Weil To: kwolf@redhat.com, QEMU Developers , sgrubb@redhat.com Date: Thu, 19 Nov 2009 19:44:55 +0100 Message-Id: <1258656295-5688-1-git-send-email-weil@mail.berlios.de> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <200911191311.56137.sgrubb@redhat.com> References: <200911191311.56137.sgrubb@redhat.com> X-Provags-ID: V01U2FsdGVkX18lEanSU4CoYdY/ocHkCxYO2Pk2Uur53HSb30a kRn0y5wzVffCeOnuNs86lkybCb8S7aEw7Fpkf05VX49p8hk2DB baI7awyVTdQZPUBPKgk/tsJlX0oVl82R1ZymuCZtIDvDgHh1+i f/A== X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Subject: [Qemu-devel] [PATCH] e1000: Fix warning from code review X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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