From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yzqck-0001bm-0D for qemu-devel@nongnu.org; Tue, 02 Jun 2015 14:09:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yzqcf-00068W-8x for qemu-devel@nongnu.org; Tue, 02 Jun 2015 14:09:13 -0400 Received: from smtp2-g21.free.fr ([2a01:e0c:1:1599::11]:14403) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yzqcf-00068I-3x for qemu-devel@nongnu.org; Tue, 02 Jun 2015 14:09:09 -0400 Message-ID: <556DF073.2030207@reactos.org> Date: Tue, 02 Jun 2015 20:05:39 +0200 From: =?ISO-8859-15?Q?Herv=E9_Poussineau?= MIME-Version: 1.0 References: <1432729200-5322-1-git-send-email-hpoussin@reactos.org> <1432729200-5322-15-git-send-email-hpoussin@reactos.org> <20150602110457.GN26298@aurel32.net> In-Reply-To: <20150602110457.GN26298@aurel32.net> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 14/17] net/dp8393x: correctly reset in_use field List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Leon Alrae Le 02/06/2015 13:04, Aurelien Jarno a =E9crit : > On 2015-05-27 14:19, Herv=E9 Poussineau wrote: >> Don't write more than the field width, which is always 16 bit. >> Fixes network in NetBSD 5.1/arc >> >> Signed-off-by: Herv=E9 Poussineau >> --- >> hw/net/dp8393x.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c >> index 4184045..b72b0b1 100644 >> --- a/hw/net/dp8393x.c >> +++ b/hw/net/dp8393x.c >> @@ -761,10 +761,10 @@ static ssize_t dp8393x_receive(NetClientState *n= c, const uint8_t * buf, >> /* EOL detected */ >> s->regs[SONIC_ISR] |=3D SONIC_ISR_RDE; >> } else { >> - data[0 * width] =3D 0; /* in_use */ >> + uint16_t in_use =3D 0; >> address_space_rw(&s->as, >> ((s->regs[SONIC_URDA] << 16) | s->regs[SONIC_CRDA]) + si= zeof(uint16_t) * 6 * width, >> - MEMTXATTRS_UNSPECIFIED, (uint8_t *)data, size, 1); >> + MEMTXATTRS_UNSPECIFIED, (uint8_t *)&in_use, sizeof(uint16= _t), 1); > > Why not initialising both data[0] and data[1] to 0 and a fixed size of = 2 > bytes instead of using a new variable? I'll do that if a v3 is required. > >> s->regs[SONIC_CRDA] =3D s->regs[SONIC_LLFA]; >> s->regs[SONIC_ISR] |=3D SONIC_ISR_PKTRX; >> s->regs[SONIC_RSC] =3D (s->regs[SONIC_RSC] & 0xff00) | (((s-= >regs[SONIC_RSC] & 0x00ff) + 1) & 0x00ff); > > That said: > Reviewed-by: Aurelien Jarno > Herv=E9