From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B94A7A04C2; Mon, 25 Nov 2019 16:23:12 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6A84328EE; Mon, 25 Nov 2019 16:23:11 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id B9C80A3 for ; Mon, 25 Nov 2019 16:23:09 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Nov 2019 07:23:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,241,1571727600"; d="scan'208";a="206168153" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.223.2]) by fmsmga008.fm.intel.com with ESMTP; 25 Nov 2019 07:23:07 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Date: Mon, 25 Nov 2019 15:23:03 +0000 Message-Id: <20191125152303.68461-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] examples/ioat: handle failure case for ioat dequeue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On a failure with the ioat dequeue, -1 is returned, which was not properly handled. This could lead to out-of-bounds reads on a later loop which assumed a positive return value. Fix this by treating an error as though a dequeue of 0 had been encountered. Coverity issue: 350342 Fixes: 2328542ed84e ("examples/ioat: add rawdev copy mode") Signed-off-by: Bruce Richardson --- examples/ioat/ioatfwd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c index 5e623a4d5..9fc033bc3 100644 --- a/examples/ioat/ioatfwd.c +++ b/examples/ioat/ioatfwd.c @@ -457,7 +457,7 @@ ioat_tx_port(struct rxtx_port_config *tx_config) MAX_PKT_BURST, NULL); } - if (nb_dq == 0) + if (nb_dq <= 0) return; if (copy_mode == COPY_MODE_IOAT_NUM) -- 2.21.0