From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EB338A0547 for ; Tue, 11 Oct 2022 11:44:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E274942D33; Tue, 11 Oct 2022 11:44:28 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 4E68042829; Tue, 11 Oct 2022 11:44:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665481466; x=1697017466; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=79g3SXBsdoP08dbCE5J57OYhBriAL6C3PS9YrNRvEug=; b=LdaErlkqDgVorIM2Q2gHVTvyIzirM1tvIPyrJfoR2gILXRRFulF56Mhd Fx2OTUdkCnq6QKqxEKAD/SD2hKcuUqRbSr8QTdceqec9gMFBwBv9IinSI tsQl5cqqPZwEc/mRbHT+9JFSy7XgVLMjw3nnA7Zh0utXD51PCrpSBRdGb pYQeLiuh1j12wgU6p7zjaHc9Bjxt1e/kHyqOATjT9qu3UUvm/im0sjC3s QcyJel8b9gFJzHKT03D/7OwrJpkkNp9Hf4oiTYG/Z3Gyr7x1gSJoxRjmI Huqg2VzyWE7PuA3T8VE47H4jax/4zxubm6x+pdcCQfvg+BhdoFVI8ItF7 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10496"; a="390767015" X-IronPort-AV: E=Sophos;i="5.95,176,1661842800"; d="scan'208";a="390767015" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2022 02:44:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10496"; a="871447027" X-IronPort-AV: E=Sophos;i="5.95,176,1661842800"; d="scan'208";a="871447027" Received: from silpixa00400884.ir.intel.com ([10.243.22.82]) by fmsmga006.fm.intel.com with ESMTP; 11 Oct 2022 02:44:24 -0700 From: Radu Nicolau To: Jingjing Wu , Beilei Xing Cc: dev@dpdk.org, qi.z.zhang@intel.com, Radu Nicolau , stable@dpdk.org Subject: [PATCH] net/iavf: fix IPsec flow create error check Date: Tue, 11 Oct 2022 10:44:21 +0100 Message-Id: <20221011094421.3410963-1-radu.nicolau@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Fix an error check where the return code was assigned to a unsigned integer which can hide negative error codes. Fixes: 6bc987ecb860 ("net/iavf: support IPsec inline crypto") Cc: stable@dpdk.org Signed-off-by: Radu Nicolau --- drivers/net/iavf/iavf_ipsec_crypto.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/iavf/iavf_ipsec_crypto.c b/drivers/net/iavf/iavf_ipsec_crypto.c index afd7f8f467..b50149c0ce 100644 --- a/drivers/net/iavf/iavf_ipsec_crypto.c +++ b/drivers/net/iavf/iavf_ipsec_crypto.c @@ -1851,6 +1851,7 @@ iavf_ipsec_flow_create(struct iavf_adapter *ad, struct rte_flow_error *error) { struct iavf_ipsec_flow_item *ipsec_flow = meta; + int flow_id = -1; if (!ipsec_flow) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, @@ -1859,8 +1860,7 @@ iavf_ipsec_flow_create(struct iavf_adapter *ad, } if (ipsec_flow->is_ipv4) { - ipsec_flow->id = - iavf_ipsec_crypto_inbound_security_policy_add(ad, + flow_id = iavf_ipsec_crypto_inbound_security_policy_add(ad, ipsec_flow->spi, 1, ipsec_flow->ipv4_hdr.dst_addr, @@ -1869,8 +1869,7 @@ iavf_ipsec_flow_create(struct iavf_adapter *ad, ipsec_flow->is_udp, ipsec_flow->udp_hdr.dst_port); } else { - ipsec_flow->id = - iavf_ipsec_crypto_inbound_security_policy_add(ad, + flow_id = iavf_ipsec_crypto_inbound_security_policy_add(ad, ipsec_flow->spi, 0, 0, @@ -1880,13 +1879,14 @@ iavf_ipsec_flow_create(struct iavf_adapter *ad, ipsec_flow->udp_hdr.dst_port); } - if (ipsec_flow->id < 1) { + if (flow_id < 1) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "Failed to add SA."); return -rte_errno; } + ipsec_flow->id = flow_id; flow->rule = ipsec_flow; return 0; -- 2.25.1