From nobody Tue Feb 10 23:59:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152848855879549.80009611267644; Fri, 8 Jun 2018 13:09:18 -0700 (PDT) Received: from localhost ([::1]:37975 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRNhF-0000iy-Ti for importer@patchew.org; Fri, 08 Jun 2018 16:09:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47953) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRNf0-0007gj-Cg for qemu-devel@nongnu.org; Fri, 08 Jun 2018 16:07:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRNez-0006sc-ES for qemu-devel@nongnu.org; Fri, 08 Jun 2018 16:06:58 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:35181) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRNet-0006ky-SV; Fri, 08 Jun 2018 16:06:52 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.167]) with ESMTPSA (Nemesis) id 0MHQA7-1fVUOm409b-00E9a9; Fri, 08 Jun 2018 22:06:28 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Fri, 8 Jun 2018 22:05:55 +0200 Message-Id: <20180608200558.386-11-laurent@vivier.eu> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180608200558.386-1-laurent@vivier.eu> References: <20180608200558.386-1-laurent@vivier.eu> X-Provags-ID: V03:K1:186I45Z5Jbinba6ey0ll6pm6fpqE3mPTJi8c6rS8M07MGUKI6Fh KJUMLGaZUynYNm+wNyVtd/Pj4R0sng5dm9t4/2L+nqJr8Ibdle6hWKVD1sytUe4pl9/kx7O UXEF4y7mWCuM8ErS8h4UViGG2dKzwZgkskBlMNehIhAMfvWRFCFWvBNZR39Qruv7rdhuj7m 9FYyF2zUYo3Bbs0a1Ow8w== X-UI-Out-Filterresults: notjunk:1;V01:K0:0dCWD/fZGtc=:wD6TP5NzJ6QelK6zvOEWTk mrKXXkuRxZNE9PLtfcBfoYZEFgNdAiyLcj0IlT+MsIHgVLtzLB7DzmivR/8qRlcdQEbQau281 NOOKHsVW8AaoPAE/7cGrQv7cOkTtu3E9kHQ6D0aa5YuPzE96irqtzJK0ZFTyEV1LQSXBIvhHc Qzv83LZTrT46QaR4AHvK8IwuJJ7D2WgwVxZBNJxkCRnFPKbcoUB5FDp6FNtUsIl+9HGGP0Z7e QFVil1gYgcieZ3pUPVHy7LG2bRYOnaQfYPokNrxCv+voIha95uGLsSkp5XgGghl9LBo1qJPdW wRu+L3Fb34+MbV1IYSve3NlOhl9g62TUVzGpUDgXNcqohk3RN3KF+OfhXX0gNycGF6HHyXLol BgGx+vG6NfBK0AM/7maaB0dRKu11UZ+Z4gAHOgyng0Ug4KrVy8+ZIbn63lC4pT7RL0Upcs7r9 vcQFV7vsxe5vOjfmiKzziAPKIuE002Xje1Bu9FP4xfab6gNnmNkMKZhkVJB+HKRUYp4FIR4BV yFJeZq0gaHgV3mDe4j+EuEkndHRjZz5T6bbDqx+kRW716SMU4M+2jjg+x1rholFNX2N4m6QN7 yZEPfsY9B+T3Qfo5S9NUQ727tx0GtynmP8W0BCY1S0G+v4/puZcaHKuivCuV9xpgDLtycnlFr K9DTnHBO1r95ezgEK51FSNp9xO96m471bwKgwZMbYeujLy85gUlIHxNGy8Y7jL2XtWS0= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.133 Subject: [Qemu-devel] [RFC 10/13] dp8393x: fix dp8393x_receive X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Fam Zheng , qemu-block@nongnu.org, Jason Wang , "Dr. David Alan Gilbert" , Max Reitz , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Gerd Hoffmann , Paolo Bonzini , Yongbok Kim , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Aurelien Jarno , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" address_space_rw() access size must be multiplied by width. dp8393x_receive() must return the number of bytes read, not the length of the last memory access. Signed-off-by: Laurent Vivier --- hw/net/dp8393x.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index f2d2ce344c..ef5f1eb94f 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -808,9 +808,11 @@ static ssize_t dp8393x_receive(NetClientState *nc, con= st uint8_t * buf, /* EOL detected */ s->regs[SONIC_ISR] |=3D SONIC_ISR_RDE; } else { + size =3D sizeof(uint16_t) * width; data[0 * width] =3D 0; /* in_use */ - address_space_rw(&s->as, dp8393x_crda(s) + sizeof(uint16_t) * 6 * = width, - MEMTXATTRS_UNSPECIFIED, (uint8_t *)data, sizeof(uint16_t), 1); + address_space_rw(&s->as, + dp8393x_crda(s) + sizeof(uint16_t) * 6 * width, + MEMTXATTRS_UNSPECIFIED, (uint8_t *)data, size, 1); 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); @@ -824,7 +826,7 @@ static ssize_t dp8393x_receive(NetClientState *nc, cons= t uint8_t * buf, /* Done */ dp8393x_update_irq(s); =20 - return size; + return rx_len; } =20 static void dp8393x_reset(DeviceState *dev) --=20 2.14.4