From patchwork Thu Jun 9 05:24:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Elo, Matias \(Nokia - FI/Espoo\)" X-Patchwork-Id: 69696 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp148880qgf; Wed, 8 Jun 2016 22:25:02 -0700 (PDT) X-Received: by 10.141.30.76 with SMTP id h73mr8423262qhe.101.1465449902496; Wed, 08 Jun 2016 22:25:02 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id c13si2563995qke.141.2016.06.08.22.25.01; Wed, 08 Jun 2016 22:25:02 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE dis=NONE) header.from=nokia.com Received: by lists.linaro.org (Postfix, from userid 109) id C553561930; Thu, 9 Jun 2016 05:25:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 5703C616B4; Thu, 9 Jun 2016 05:24:58 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id A9B03616D1; Thu, 9 Jun 2016 05:24:56 +0000 (UTC) Received: from demumfd001.nsn-inter.net (demumfd001.nsn-inter.net [93.183.12.32]) by lists.linaro.org (Postfix) with ESMTPS id A7E90616B1 for ; Thu, 9 Jun 2016 05:24:55 +0000 (UTC) Received: from demuprx016.emea.nsn-intra.net ([10.150.129.55]) by demumfd001.nsn-inter.net (8.15.2/8.15.2) with ESMTPS id u595OswU001787 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 9 Jun 2016 05:24:54 GMT Received: from 10.144.19.15 ([10.144.104.109]) by demuprx016.emea.nsn-intra.net (8.12.11.20060308/8.12.11) with ESMTP id u595Oruf026516 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Thu, 9 Jun 2016 07:24:54 +0200 From: Matias Elo To: lng-odp@lists.linaro.org Date: Thu, 9 Jun 2016 08:24:53 +0300 Message-Id: <1465449893-17912-1-git-send-email-matias.elo@nokia.com> X-Mailer: git-send-email 1.9.1 X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-size: 1156 X-purgate-ID: 151667::1465449894-00004C87-3B0D4897/0/0 X-Topics: patch Subject: [lng-odp] [PATCH] linux-gen: pktio: fix variable overwrite in pktin_recv_buf X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Fix variable overwrite bug in pktin_recv_buf(). Signed-off-by: Matias Elo --- platform/linux-generic/odp_packet_io.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 6de39b6..416a361 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -540,12 +540,12 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue, odp_buffer_hdr_t *buf_hdr; odp_buffer_t buf; int i; - int ret; + int pkts; int num_rx = 0; - ret = odp_pktin_recv(queue, packets, num); + pkts = odp_pktin_recv(queue, packets, num); - for (i = 0; i < ret; i++) { + for (i = 0; i < pkts; i++) { pkt = packets[i]; pkt_hdr = odp_packet_hdr(pkt); buf = _odp_packet_to_buffer(pkt); @@ -553,6 +553,7 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue, if (pkt_hdr->input_flags.dst_queue) { queue_entry_t *dst_queue; + int ret; dst_queue = queue_to_qentry(pkt_hdr->dst_queue); ret = queue_enq(dst_queue, buf_hdr, 0);