From patchwork Tue Jun 28 04:06:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Yuying" X-Patchwork-Id: 113493 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 79ADFA0544; Tue, 28 Jun 2022 06:02:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 577CC40691; Tue, 28 Jun 2022 06:02:54 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 9933D400D6; Tue, 28 Jun 2022 06:02:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656388972; x=1687924972; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=VhwRChIQucnHnIycNxqW5kCsta8yXwfZR9tQGuyZ2MU=; b=LoTwpd+IhngMTHRHGYVD6A6ulBP1pZ9KiJu8lqrAdQ7FrFb8bBR8DZoH wGw/bk9A+/ImZI+2UxDGmNMjC1etVdcv7oPZpPkgAmjxXXlgXq5bBw/jH 3JDLuQuBWE01yfUx/zEO1MQ+H9lB0NtUiHhdserkqflgQ7f2WW36t3S2b nB+zpHjtjeSqWfUzJjpQgWKHDQzPhVCfZH6ggMTvYxAs5gjJggn+e73ML oBsXKqQ5vbQw9q8UE5bYYZYNNV6VvZoUbOuJqcsWEtutf276+6AVSPZIB siIGwoDDKdfojtDeXRbFB2VtS3khTeHfJCc08HIqlENknB0DnX9wVtfBa g==; X-IronPort-AV: E=McAfee;i="6400,9594,10391"; a="343315767" X-IronPort-AV: E=Sophos;i="5.92,227,1650956400"; d="scan'208";a="343315767" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 21:02:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,227,1650956400"; d="scan'208";a="646723131" Received: from dpdk-yuyingzh-icelake.sh.intel.com ([10.67.116.210]) by fmsmga008.fm.intel.com with ESMTP; 27 Jun 2022 21:02:48 -0700 From: Yuying Zhang To: dev@dpdk.org, qi.z.zhang@intel.com Cc: Yuying Zhang , stable@dpdk.org Subject: [PATCH v1] net/ice: fix memory allocation issue of packet flag Date: Tue, 28 Jun 2022 04:06:51 +0000 Message-Id: <20220628040651.755135-1-yuying.zhang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Current code doesn't allocate memory of lookup element to add packet flag. This patch adds one lookup item in the list to fix this memory issue. Fixes: 8b95092b7f69 ("net/ice/base: fix direction of flow that matches any") Cc: stable@dpdk.org Signed-off-by: Yuying Zhang Acked-by: Qi Zhang --- drivers/net/ice/ice_switch_filter.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index 36c9bffb73..e84283fec1 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -1863,7 +1863,10 @@ ice_switch_parse_pattern_action(struct ice_adapter *ad, else if (vlan_num == 2) tun_type = ICE_NON_TUN_QINQ; - list = rte_zmalloc(NULL, item_num * sizeof(*list), 0); + /* reserve one more memory slot for direction flag which may + * consume 1 lookup item. + */ + list = rte_zmalloc(NULL, (item_num + 1) * sizeof(*list), 0); if (!list) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,