From patchwork Wed Mar 23 21:26:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarah Newman X-Patchwork-Id: 8654651 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 374889F38C for ; Wed, 23 Mar 2016 21:34:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 68576203DA for ; Wed, 23 Mar 2016 21:34:02 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 89716203C4 for ; Wed, 23 Mar 2016 21:34:01 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aiqMj-0004qV-0S; Wed, 23 Mar 2016 21:30:57 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aiqMh-0004qP-Rw for xen-devel@lists.xen.org; Wed, 23 Mar 2016 21:30:56 +0000 Received: from [193.109.254.147] by server-4.bemta-14.messagelabs.com id 6E/D0-03301-F0B03F65; Wed, 23 Mar 2016 21:30:55 +0000 X-Env-Sender: srn@prgmr.com X-Msg-Ref: server-2.tower-27.messagelabs.com!1458768652!31499173!1 X-Originating-IP: [71.19.149.6] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 44481 invoked from network); 23 Mar 2016 21:30:54 -0000 Received: from mail.prgmr.com (HELO mail.prgmr.com) (71.19.149.6) by server-2.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 23 Mar 2016 21:30:54 -0000 Received: from localhost.localdomain (173-228-60-212.dsl.dynamic.fusionbroadband.com [173.228.60.212]) (Authenticated sender: srn) by mail.prgmr.com (Postfix) with ESMTPSA id F3CB728C001; Wed, 23 Mar 2016 17:30:51 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.prgmr.com F3CB728C001 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prgmr.com; s=default; t=1458768652; bh=Cfy+C38+m4v31+knIbOZyBjllwWEOw/aZ0s+3QrC5Ag=; h=From:To:Cc:Subject:Date:From; b=S199eCneZHUyBCgsDekrs9K2sZD/fG0/YAOu4NQkpwNiBK0GnbrJcWO0Jg2DDH5LL 4g31UTkQ7WCkKUPuPLqMx62S2ZkcoSZRnhdtbg8TtDqcBVlpwyzh3PC/ygDsfhHVrU oKw4dgqY3aZFkBDKGkI+ZNtxzOe9YDRaiB/Y9q2A= From: Sarah Newman To: xen-devel@lists.xen.org Date: Wed, 23 Mar 2016 14:26:51 -0700 Message-Id: <1458768411-6024-1-git-send-email-srn@prgmr.com> X-Mailer: git-send-email 1.9.1 Cc: minios-devel@lists.xen.org, Sarah Newman Subject: [Xen-devel] [PATCH] Mini-OS: netfront: fix off-by-one error introduced in 7c8f3483 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 7c8f3483 introduced a break within a loop in netfront.c such that cons and nr_consumed were no longer always being incremented. The offset at cons will be processed multiple times with the break in place. Remove the break and re-add "some !=0" in the loop for HAVE_LIBC. Signed-off-by: Sarah Newman --- netfront.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/netfront.c b/netfront.c index 0eca5b5..557e8c4 100644 --- a/netfront.c +++ b/netfront.c @@ -108,8 +108,10 @@ moretodo: #ifdef HAVE_LIBC some = 0; -#endif + for (cons = dev->rx.rsp_cons; (cons != rp) && !some; nr_consumed++, cons++) +#else for (cons = dev->rx.rsp_cons; cons != rp; nr_consumed++, cons++) +#endif { struct net_buffer* buf; unsigned char* page; @@ -135,7 +137,6 @@ moretodo: memcpy(dev->data, page+rx->offset, len); dev->rlen = len; some = 1; - break; } else #endif dev->netif_rx(page+rx->offset,rx->status);