* [PATCH] ice/base: fix gcc 12 warning stringop-overflow @ 2022-06-16 10:33 wenxuanx.wu 2022-06-16 14:29 ` David Marchand ` (2 more replies) 0 siblings, 3 replies; 10+ messages in thread From: wenxuanx.wu @ 2022-06-16 10:33 UTC (permalink / raw) To: qiming.yang, qi.z.zhang, dev, thomas; +Cc: stephen, wenxuanx.wu, stable From: Wenxuan Wu <wenxuanx.wu@intel.com> Gcc with -O2 flag, would retrieve the value in one time. This patch changed the type of fv_idx in struct ice_recp_grp_entry to align with its callers which is also u8 type. When u8 idx[5] = a value u16 index[4], gcc12 would give this warning, because it is not big enough to store the bytes(bigger than 5 bytes) in one time (-O2 would do it in this way). Fixes: 04b8ec1ea807 ("net/ice/base: add protocol structures and defines") Cc: stable@dpdk.org Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com> --- drivers/net/ice/base/ice_protocol_type.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }; -- 2.25.1 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ice/base: fix gcc 12 warning stringop-overflow 2022-06-16 10:33 [PATCH] ice/base: fix gcc 12 warning stringop-overflow wenxuanx.wu @ 2022-06-16 14:29 ` David Marchand 2022-06-17 1:29 ` Wu, WenxuanX 2022-06-19 12:34 ` Zhang, Qi Z 2022-06-23 9:01 ` [PATCH v2] net/ice/base: " wenxuanx.wu 2 siblings, 1 reply; 10+ messages in thread From: David Marchand @ 2022-06-16 14:29 UTC (permalink / raw) To: Wenxuan Wu Cc: Qiming Yang, Qi Zhang, dev, Thomas Monjalon, Stephen Hemminger, dpdk stable Title should start with net/ice/base:. On Thu, Jun 16, 2022 at 12:35 PM <wenxuanx.wu@intel.com> wrote: > > From: Wenxuan Wu <wenxuanx.wu@intel.com> > > Gcc with -O2 flag, would retrieve the value in one time. > This patch changed the type of fv_idx in struct ice_recp_grp_entry to > align with its callers which is also u8 type. > > When u8 idx[5] = a value u16 index[4], gcc12 would give this warning, > because it is not big enough to store the bytes(bigger than 5 bytes) > in one time (-O2 would do it in this way). > > Fixes: 04b8ec1ea807 ("net/ice/base: add protocol structures and defines") > Cc: stable@dpdk.org Missing empty line. > Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com> Only build tested. Tested-by: David Marchand <david.marchand@redhat.com> -- David Marchand ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH] ice/base: fix gcc 12 warning stringop-overflow 2022-06-16 14:29 ` David Marchand @ 2022-06-17 1:29 ` Wu, WenxuanX 2022-06-17 5:04 ` David Marchand 0 siblings, 1 reply; 10+ messages in thread From: Wu, WenxuanX @ 2022-06-17 1:29 UTC (permalink / raw) To: David Marchand Cc: Yang, Qiming, Zhang, Qi Z, dev, Thomas Monjalon, Stephen Hemminger, dpdk stable Thanks, do I need to send a new version to resolve formatting issues? > -----Original Message----- > From: David Marchand <david.marchand@redhat.com> > Sent: 2022年6月16日 22:29 > To: Wu, WenxuanX <wenxuanx.wu@intel.com> > Cc: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z > <qi.z.zhang@intel.com>; dev <dev@dpdk.org>; Thomas Monjalon > <thomas@monjalon.net>; Stephen Hemminger > <stephen@networkplumber.org>; dpdk stable <stable@dpdk.org> > Subject: Re: [PATCH] ice/base: fix gcc 12 warning stringop-overflow > > Title should start with net/ice/base:. > > On Thu, Jun 16, 2022 at 12:35 PM <wenxuanx.wu@intel.com> wrote: > > > > From: Wenxuan Wu <wenxuanx.wu@intel.com> > > > > Gcc with -O2 flag, would retrieve the value in one time. > > This patch changed the type of fv_idx in struct ice_recp_grp_entry to > > align with its callers which is also u8 type. > > > > When u8 idx[5] = a value u16 index[4], gcc12 would give this warning, > > because it is not big enough to store the bytes(bigger than 5 bytes) > > in one time (-O2 would do it in this way). > > > > Fixes: 04b8ec1ea807 ("net/ice/base: add protocol structures and > > defines") > > Cc: stable@dpdk.org > Missing empty line. > > > Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com> > > Only build tested. > Tested-by: David Marchand <david.marchand@redhat.com> > > > -- > David Marchand ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ice/base: fix gcc 12 warning stringop-overflow 2022-06-17 1:29 ` Wu, WenxuanX @ 2022-06-17 5:04 ` David Marchand 0 siblings, 0 replies; 10+ messages in thread From: David Marchand @ 2022-06-17 5:04 UTC (permalink / raw) To: Wu, WenxuanX Cc: Yang, Qiming, Zhang, Qi Z, dev, Thomas Monjalon, Stephen Hemminger, dpdk stable On Fri, Jun 17, 2022 at 3:29 AM Wu, WenxuanX <wenxuanx.wu@intel.com> wrote: > > Thanks, do I need to send a new version to resolve formatting issues? You are not a new contributor, please pay attention to such details. To answer your question, I don't think there is a need for a new version unless someone has a better idea for fixing. Maintainer who applies the fix will handle it. -- David Marchand ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH] ice/base: fix gcc 12 warning stringop-overflow 2022-06-16 10:33 [PATCH] ice/base: fix gcc 12 warning stringop-overflow wenxuanx.wu 2022-06-16 14:29 ` David Marchand @ 2022-06-19 12:34 ` Zhang, Qi Z 2022-06-20 1:38 ` Wu, WenxuanX 2022-06-23 9:01 ` [PATCH v2] net/ice/base: " wenxuanx.wu 2 siblings, 1 reply; 10+ messages in thread From: Zhang, Qi Z @ 2022-06-19 12:34 UTC (permalink / raw) To: Wu, WenxuanX, Yang, Qiming, dev, thomas; +Cc: stephen, stable > -----Original Message----- > From: Wu, WenxuanX <wenxuanx.wu@intel.com> > Sent: Thursday, June 16, 2022 6:33 PM > To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z > <qi.z.zhang@intel.com>; dev@dpdk.org; thomas@monjalon.net > Cc: stephen@networkplumber.org; Wu, WenxuanX <wenxuanx.wu@intel.com>; > stable@dpdk.org > Subject: [PATCH] ice/base: fix gcc 12 warning stringop-overflow > > From: Wenxuan Wu <wenxuanx.wu@intel.com> > > Gcc with -O2 flag, would retrieve the value in one time. > This patch changed the type of fv_idx in struct ice_recp_grp_entry to align with > its callers which is also u8 type. > > When u8 idx[5] = a value u16 index[4], gcc12 would give this warning, because > it is not big enough to store the bytes(bigger than 5 bytes) in one time (-O2 > would do it in this way). > > Fixes: 04b8ec1ea807 ("net/ice/base: add protocol structures and defines") > Cc: stable@dpdk.org > Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com> > --- > drivers/net/ice/base/ice_protocol_type.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > 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]; If you change the data type from u16 to u8 for the FV index, you'd better also change the type of all the symbols to store the same thing. e.g. the parameter "fv_idx" of ice_find_prot_off. So, what's exactly the issue that GCC 12 reported? can we fix it from the other side without changing a type in the base code? > u16 fv_mask[ICE_NUM_WORDS_RECIPE]; > struct ice_pref_recipe_group r_group; > }; > -- > 2.25.1 ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH] ice/base: fix gcc 12 warning stringop-overflow 2022-06-19 12:34 ` Zhang, Qi Z @ 2022-06-20 1:38 ` Wu, WenxuanX 2022-06-20 5:06 ` Wu, WenxuanX 0 siblings, 1 reply; 10+ messages in thread From: Wu, WenxuanX @ 2022-06-20 1:38 UTC (permalink / raw) To: Zhang, Qi Z, Yang, Qiming, dev, thomas; +Cc: stephen, stable Hi all, The warning below gcc 12 : inlined from ‘ice_add_adv_recipe’ at ../drivers/net/ice/base/ice_switch.c:7951:11, inlined from ‘ice_add_adv_rule’ at ../drivers/net/ice/base/ice_switch.c:8911:11: ../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]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ In file included from ../drivers/net/ice/base/ice_controlq.h:8, from ../drivers/net/ice/base/ice_type.h:54, from ../drivers/net/ice/base/ice_common.h:8, from ../drivers/net/ice/base/ice_switch.h:8, from ../drivers/net/ice/base/ice_switch.c:5: ../drivers/net/ice/base/ice_adminq_cmd.h: In function ‘ice_add_adv_rule’: ../drivers/net/ice/base/ice_adminq_cmd.h:744:12: note: at offset 5 into destination object ‘lkup_indx’ of size 5 744 | u8 lkup_indx[5]; | ^~~~~~~~~ In function ‘ice_add_sw_recipe’, inlined from ‘ice_add_adv_recipe’ at ../drivers/net/ice/base/ice_switch.c:7951:11, inlined from ‘ice_add_adv_rule’ at ../drivers/net/ice/base/ice_switch.c:8911:11: ../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]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ ../drivers/net/ice/base/ice_adminq_cmd.h: In function ‘ice_add_adv_rule’: ../drivers/net/ice/base/ice_adminq_cmd.h:744:12: note: at offset [6, 254] into destination object ‘lkup_indx’ of size 5 744 | u8 lkup_indx[5]; | ^~~~~~~~~ In function ‘ice_add_sw_recipe’, inlined from ‘ice_add_adv_recipe’ at ../drivers/net/ice/base/ice_switch.c:7951:11, inlined from ‘ice_add_adv_rule’ at ../drivers/net/ice/base/ice_switch.c:8911:11: ../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]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ ../drivers/net/ice/base/ice_adminq_cmd.h: In function ‘ice_add_adv_rule’: ../drivers/net/ice/base/ice_adminq_cmd.h:744:12: note: at offset [7, 255] into destination object ‘lkup_indx’ of size 5 744 | u8 lkup_indx[5]; | ^~~~~~~~~ cc1: all warnings being treated as errors Thanks Wenxuan > -----Original Message----- > From: Zhang, Qi Z <qi.z.zhang@intel.com> > Sent: 2022年6月19日 20:35 > To: Wu, WenxuanX <wenxuanx.wu@intel.com>; Yang, Qiming > <qiming.yang@intel.com>; dev@dpdk.org; thomas@monjalon.net > Cc: stephen@networkplumber.org; stable@dpdk.org > Subject: RE: [PATCH] ice/base: fix gcc 12 warning stringop-overflow > > > > > -----Original Message----- > > From: Wu, WenxuanX <wenxuanx.wu@intel.com> > > Sent: Thursday, June 16, 2022 6:33 PM > > To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z > > <qi.z.zhang@intel.com>; dev@dpdk.org; thomas@monjalon.net > > Cc: stephen@networkplumber.org; Wu, WenxuanX > <wenxuanx.wu@intel.com>; > > stable@dpdk.org > > Subject: [PATCH] ice/base: fix gcc 12 warning stringop-overflow > > > > From: Wenxuan Wu <wenxuanx.wu@intel.com> > > > > Gcc with -O2 flag, would retrieve the value in one time. > > This patch changed the type of fv_idx in struct ice_recp_grp_entry to > > align with its callers which is also u8 type. > > > > When u8 idx[5] = a value u16 index[4], gcc12 would give this warning, > > because it is not big enough to store the bytes(bigger than 5 bytes) > > in one time (-O2 would do it in this way). > > > > Fixes: 04b8ec1ea807 ("net/ice/base: add protocol structures and > > defines") > > Cc: stable@dpdk.org > > Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com> > > --- > > drivers/net/ice/base/ice_protocol_type.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > 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]; > > If you change the data type from u16 to u8 for the FV index, you'd better also > change the type of all the symbols to store the same thing. e.g. the > parameter "fv_idx" of ice_find_prot_off. > So, what's exactly the issue that GCC 12 reported? can we fix it from the > other side without changing a type in the base code? > > > > u16 fv_mask[ICE_NUM_WORDS_RECIPE]; > > struct ice_pref_recipe_group r_group; }; > > -- > > 2.25.1 ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH] ice/base: fix gcc 12 warning stringop-overflow 2022-06-20 1:38 ` Wu, WenxuanX @ 2022-06-20 5:06 ` Wu, WenxuanX 2022-06-23 7:42 ` David Marchand 0 siblings, 1 reply; 10+ messages in thread From: Wu, WenxuanX @ 2022-06-20 5:06 UTC (permalink / raw) To: Wu, WenxuanX, Zhang, Qi Z, Yang, Qiming, dev, thomas; +Cc: stephen, stable > -----Original Message----- > From: Wu, WenxuanX <wenxuanx.wu@intel.com> > Sent: 2022年6月20日 9:39 > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming > <qiming.yang@intel.com>; dev@dpdk.org; thomas@monjalon.net > Cc: stephen@networkplumber.org; stable@dpdk.org > Subject: RE: [PATCH] ice/base: fix gcc 12 warning stringop-overflow > > Hi all, > > The warning below gcc 12 : > inlined from ‘ice_add_adv_recipe’ > at ../drivers/net/ice/base/ice_switch.c:7951:11, > inlined from ‘ice_add_adv_rule’ > at ../drivers/net/ice/base/ice_switch.c:8911:11: > ../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]; > | > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ > In file included from ../drivers/net/ice/base/ice_controlq.h:8, > from ../drivers/net/ice/base/ice_type.h:54, > from ../drivers/net/ice/base/ice_common.h:8, > from ../drivers/net/ice/base/ice_switch.h:8, > from ../drivers/net/ice/base/ice_switch.c:5: > ../drivers/net/ice/base/ice_adminq_cmd.h: In function ‘ice_add_adv_rule’: > ../drivers/net/ice/base/ice_adminq_cmd.h:744:12: note: at offset 5 into > destination object ‘lkup_indx’ of size 5 > 744 | u8 lkup_indx[5]; > | ^~~~~~~~~ > In function ‘ice_add_sw_recipe’, > inlined from ‘ice_add_adv_recipe’ > at ../drivers/net/ice/base/ice_switch.c:7951:11, > inlined from ‘ice_add_adv_rule’ > at ../drivers/net/ice/base/ice_switch.c:8911:11: > ../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]; > | > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ > ../drivers/net/ice/base/ice_adminq_cmd.h: In function ‘ice_add_adv_rule’: > ../drivers/net/ice/base/ice_adminq_cmd.h:744:12: note: at offset [6, 254] > into destination object ‘lkup_indx’ of size 5 > 744 | u8 lkup_indx[5]; > | ^~~~~~~~~ > In function ‘ice_add_sw_recipe’, > inlined from ‘ice_add_adv_recipe’ > at ../drivers/net/ice/base/ice_switch.c:7951:11, > inlined from ‘ice_add_adv_rule’ > at ../drivers/net/ice/base/ice_switch.c:8911:11: > ../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]; > | > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ > ../drivers/net/ice/base/ice_adminq_cmd.h: In function ‘ice_add_adv_rule’: > ../drivers/net/ice/base/ice_adminq_cmd.h:744:12: note: at offset [7, 255] > into destination object ‘lkup_indx’ of size 5 > 744 | u8 lkup_indx[5]; > | ^~~~~~~~~ > cc1: all warnings being treated as errors > > Thanks > Wenxuan > > > -----Original Message----- > > From: Zhang, Qi Z <qi.z.zhang@intel.com> > > Sent: 2022年6月19日 20:35 > > To: Wu, WenxuanX <wenxuanx.wu@intel.com>; Yang, Qiming > > <qiming.yang@intel.com>; dev@dpdk.org; thomas@monjalon.net > > Cc: stephen@networkplumber.org; stable@dpdk.org > > Subject: RE: [PATCH] ice/base: fix gcc 12 warning stringop-overflow > > > > > > > > > -----Original Message----- > > > From: Wu, WenxuanX <wenxuanx.wu@intel.com> > > > Sent: Thursday, June 16, 2022 6:33 PM > > > To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z > > > <qi.z.zhang@intel.com>; dev@dpdk.org; thomas@monjalon.net > > > Cc: stephen@networkplumber.org; Wu, WenxuanX > > <wenxuanx.wu@intel.com>; > > > stable@dpdk.org > > > Subject: [PATCH] ice/base: fix gcc 12 warning stringop-overflow > > > > > > From: Wenxuan Wu <wenxuanx.wu@intel.com> > > > > > > Gcc with -O2 flag, would retrieve the value in one time. > > > This patch changed the type of fv_idx in struct ice_recp_grp_entry > > > to align with its callers which is also u8 type. > > > > > > When u8 idx[5] = a value u16 index[4], gcc12 would give this > > > warning, because it is not big enough to store the bytes(bigger than > > > 5 bytes) in one time (-O2 would do it in this way). > > > > > > Fixes: 04b8ec1ea807 ("net/ice/base: add protocol structures and > > > defines") > > > Cc: stable@dpdk.org > > > Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com> > > > --- > > > drivers/net/ice/base/ice_protocol_type.h | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > 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]; > > > > If you change the data type from u16 to u8 for the FV index, you'd > > better also change the type of all the symbols to store the same > > thing. e.g. the parameter "fv_idx" of ice_find_prot_off. > > So, what's exactly the issue that GCC 12 reported? can we fix it from > > the other side without changing a type in the base code? change from u8 lkup_indx[5] to u16 lkup_indx[5] can also resolve this issue. > > > > > > > u16 fv_mask[ICE_NUM_WORDS_RECIPE]; > > > struct ice_pref_recipe_group r_group; }; > > > -- > > > 2.25.1 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ice/base: fix gcc 12 warning stringop-overflow 2022-06-20 5:06 ` Wu, WenxuanX @ 2022-06-23 7:42 ` David Marchand 0 siblings, 0 replies; 10+ messages in thread From: David Marchand @ 2022-06-23 7:42 UTC (permalink / raw) To: Wu, WenxuanX, Zhang, Qi Z Cc: Yang, Qiming, dev, thomas, stephen, stable, Ferruh Yigit On Mon, Jun 20, 2022 at 7:06 AM Wu, WenxuanX <wenxuanx.wu@intel.com> wrote: > > > > 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]; > > > > > > If you change the data type from u16 to u8 for the FV index, you'd > > > better also change the type of all the symbols to store the same > > > thing. e.g. the parameter "fv_idx" of ice_find_prot_off. > > > So, what's exactly the issue that GCC 12 reported? can we fix it from > > > the other side without changing a type in the base code? > change from u8 lkup_indx[5] to u16 lkup_indx[5] can also resolve this issue. Any update? Thanks. -- David Marchand ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2] net/ice/base: fix gcc 12 warning stringop-overflow 2022-06-16 10:33 [PATCH] ice/base: fix gcc 12 warning stringop-overflow wenxuanx.wu 2022-06-16 14:29 ` David Marchand 2022-06-19 12:34 ` Zhang, Qi Z @ 2022-06-23 9:01 ` wenxuanx.wu 2022-06-23 9:21 ` Zhang, Qi Z 2 siblings, 1 reply; 10+ messages in thread From: wenxuanx.wu @ 2022-06-23 9:01 UTC (permalink / raw) To: dev, thomas, qiming.yang, qi.z.zhang Cc: stephen, wenxuanx.wu, yidingx.zhou, stable From: Wenxuan Wu <wenxuanx.wu@intel.com> 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 <wenxuanx.wu@intel.com> --- 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 ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH v2] net/ice/base: fix gcc 12 warning stringop-overflow 2022-06-23 9:01 ` [PATCH v2] net/ice/base: " wenxuanx.wu @ 2022-06-23 9:21 ` Zhang, Qi Z 0 siblings, 0 replies; 10+ messages in thread From: Zhang, Qi Z @ 2022-06-23 9:21 UTC (permalink / raw) To: Wu, WenxuanX, dev, thomas, Yang, Qiming; +Cc: stephen, Zhou, YidingX, stable > -----Original Message----- > From: Wu, WenxuanX <wenxuanx.wu@intel.com> > Sent: Thursday, June 23, 2022 5:01 PM > To: dev@dpdk.org; thomas@monjalon.net; Yang, Qiming > <qiming.yang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com> > Cc: stephen@networkplumber.org; Wu, WenxuanX > <wenxuanx.wu@intel.com>; Zhou, YidingX <yidingx.zhou@intel.com>; > stable@dpdk.org > Subject: [PATCH v2] net/ice/base: fix gcc 12 warning stringop-overflow > > From: Wenxuan Wu <wenxuanx.wu@intel.com> > > 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 <wenxuanx.wu@intel.com> Acked-by: Qi Zhang <qi.z.zhang@intel.com> Applied to dpdk-next-net-intel. Thanks Qi ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-06-23 9:21 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-06-16 10:33 [PATCH] ice/base: fix gcc 12 warning stringop-overflow wenxuanx.wu 2022-06-16 14:29 ` David Marchand 2022-06-17 1:29 ` Wu, WenxuanX 2022-06-17 5:04 ` David Marchand 2022-06-19 12:34 ` Zhang, Qi Z 2022-06-20 1:38 ` Wu, WenxuanX 2022-06-20 5:06 ` Wu, WenxuanX 2022-06-23 7:42 ` David Marchand 2022-06-23 9:01 ` [PATCH v2] net/ice/base: " wenxuanx.wu 2022-06-23 9:21 ` Zhang, Qi Z
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).