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 A8C0DA0093 for ; Thu, 23 Jun 2022 11:05:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8547F4003F; Thu, 23 Jun 2022 11:05:24 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 1EB9C4003F; Thu, 23 Jun 2022 11:05:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655975123; x=1687511123; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dbPXQ4L0OsD8bfVXsScqziku+YKkc5c3S3Q66MBzV/k=; b=Ssng6fg0tyEY2TTrchAhBEmCBtgD1yfDrSpuC6Ba439281fAGOzmMHHC q4E4EWXA4RrD4yeA3YAjCMNOkdxaqQ0iAg8CU+y73SIopHUS7Kc+1alS+ PNTBUWqhyM1p/5nYjsGNKEFHUAEFN9iaMFckZva2NJD0W1GqYAslztOQf 8F1bgodI9fScjLfObCRSGpQQ2C3a5h50L8zI/LE9CNhuF3u/t9NT4pdic TnG9WuDAz/+b4PfkICOasb1pv3jlGC5u4osBGp9qWr3Eo1qaGz3Jmsjz4 3Sa2ddtKa9XDCwG4i5cxtPntQIfsoJZGS9V0gjftdxHpYQvuh9zpGtZM6 g==; X-IronPort-AV: E=McAfee;i="6400,9594,10386"; a="366986701" X-IronPort-AV: E=Sophos;i="5.92,215,1650956400"; d="scan'208";a="366986701" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2022 02:02:25 -0700 X-IronPort-AV: E=Sophos;i="5.92,215,1650956400"; d="scan'208";a="644644155" Received: from unknown (HELO localhost.localdomain) ([10.239.252.3]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2022 02:02:23 -0700 From: wenxuanx.wu@intel.com To: dev@dpdk.org, thomas@monjalon.net, qiming.yang@intel.com, qi.z.zhang@intel.com Cc: stephen@networkplumber.org, wenxuanx.wu@intel.com, yidingx.zhou@intel.com, stable@dpdk.org Subject: [PATCH v2] net/ice/base: fix gcc 12 warning stringop-overflow Date: Thu, 23 Jun 2022 17:01:05 +0800 Message-Id: <20220623090105.645154-1-wenxuanx.wu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616103304.132368-1-wenxuanx.wu@intel.com> References: <20220616103304.132368-1-wenxuanx.wu@intel.com> 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 From: Wenxuan Wu gcc 12 with -O2 flag would raise the following warning: ../drivers/net/ice/base/ice_switch.c:7220:61: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=] 7220 | buf[recps].content.lkup_indx[i + 1] = entry->fv_idx[i]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ This patch changed the type of fv_idx in struct ice_recp_grp_entry to align with its callers which are also u8 type. Fixes: 04b8ec1ea807 ("net/ice/base: add protocol structures and defines") Cc: stable@dpdk.org Signed-off-by: Wenxuan Wu --- drivers/net/ice/base/ice_flex_pipe.c | 2 +- drivers/net/ice/base/ice_flex_pipe.h | 2 +- drivers/net/ice/base/ice_protocol_type.h | 2 +- drivers/net/ice/base/ice_switch.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c index f6a29f87c5..3918169001 100644 --- a/drivers/net/ice/base/ice_flex_pipe.c +++ b/drivers/net/ice/base/ice_flex_pipe.c @@ -2564,7 +2564,7 @@ enum ice_status ice_destroy_tunnel(struct ice_hw *hw, u16 port, bool all) * @off: variable to receive the protocol offset */ enum ice_status -ice_find_prot_off(struct ice_hw *hw, enum ice_block blk, u8 prof, u16 fv_idx, +ice_find_prot_off(struct ice_hw *hw, enum ice_block blk, u8 prof, u8 fv_idx, u8 *prot, u16 *off) { struct ice_fv_word *fv_ext; diff --git a/drivers/net/ice/base/ice_flex_pipe.h b/drivers/net/ice/base/ice_flex_pipe.h index 23ba45564a..ab897de4f3 100644 --- a/drivers/net/ice/base/ice_flex_pipe.h +++ b/drivers/net/ice/base/ice_flex_pipe.h @@ -25,7 +25,7 @@ enum ice_status ice_acquire_change_lock(struct ice_hw *hw, enum ice_aq_res_access_type access); void ice_release_change_lock(struct ice_hw *hw); enum ice_status -ice_find_prot_off(struct ice_hw *hw, enum ice_block blk, u8 prof, u16 fv_idx, +ice_find_prot_off(struct ice_hw *hw, enum ice_block blk, u8 prof, u8 fv_idx, u8 *prot, u16 *off); enum ice_status ice_find_label_value(struct ice_seg *ice_seg, char const *name, u32 type, diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h index 0e6e5990be..cfe3b62630 100644 --- a/drivers/net/ice/base/ice_protocol_type.h +++ b/drivers/net/ice/base/ice_protocol_type.h @@ -421,7 +421,7 @@ struct ice_recp_grp_entry { #define ICE_INVAL_CHAIN_IND 0xFF u16 rid; u8 chain_idx; - u16 fv_idx[ICE_NUM_WORDS_RECIPE]; + u8 fv_idx[ICE_NUM_WORDS_RECIPE]; u16 fv_mask[ICE_NUM_WORDS_RECIPE]; struct ice_pref_recipe_group r_group; }; diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h index a2b3c80107..c67cd09d21 100644 --- a/drivers/net/ice/base/ice_switch.h +++ b/drivers/net/ice/base/ice_switch.h @@ -203,7 +203,7 @@ struct ice_fltr_info { struct ice_update_recipe_lkup_idx_params { u16 rid; - u16 fv_idx; + u8 fv_idx; bool ignore_valid; u16 mask; bool mask_valid; -- 2.25.1