* [PATCH v3 net-next] net/intel: Replace manual array size calculation with ARRAY_SIZE [not found] <CGME20260428103757eucas1p132f3f1123fae21d596a51cbdce72c931@eucas1p1.samsung.com> @ 2026-04-28 10:36 ` Jakub Raczynski 2026-04-28 14:06 ` Przemek Kitszel 0 siblings, 1 reply; 6+ messages in thread From: Jakub Raczynski @ 2026-04-28 10:36 UTC (permalink / raw) To: intel-wired-lan Cc: netdev, kuba, linux-kernel, kernel-janitors, przemyslaw.kitszel, error27, Jakub Raczynski There are still places in the code where manual calculation of array size exist, but it is good to enforce usage of single macro through the whole code as it makes code bit more readable. While at it, beautify condition surrounding it by reversing check and remove unnecessary casting. Signed-off-by: Jakub Raczynski <j.raczynski@samsung.com> Reviewed-by: Dan Carpenter <error27@gmail.com> --- Link to v1/v2: https://lore.kernel.org/kernel-janitors/20260421114029.2689961-1-j.raczynski@samsung.com/ Changes in v3: - Add 'Reviewed-by' from previous thread Changes in v2: - Beautify code by removing excessive parentheses - Reverse if condition to remove negation of whole check drivers/net/ethernet/intel/i40e/i40e_adminq.h | 2 +- drivers/net/ethernet/intel/iavf/iavf_adminq.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.h b/drivers/net/ethernet/intel/i40e/i40e_adminq.h index 1be97a3a86ce..dcf3baec7b73 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_adminq.h +++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.h @@ -109,7 +109,7 @@ static inline int i40e_aq_rc_to_posix(int aq_ret, int aq_rc) -EFBIG, /* I40E_AQ_RC_EFBIG */ }; - if (!((u32)aq_rc < (sizeof(aq_to_posix) / sizeof((aq_to_posix)[0])))) + if (aq_rc >= ARRAY_SIZE(aq_to_posix)) return -ERANGE; return aq_to_posix[aq_rc]; diff --git a/drivers/net/ethernet/intel/iavf/iavf_adminq.h b/drivers/net/ethernet/intel/iavf/iavf_adminq.h index bbf5c4b3a2ae..dd2f61172157 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_adminq.h +++ b/drivers/net/ethernet/intel/iavf/iavf_adminq.h @@ -113,7 +113,7 @@ static inline int iavf_aq_rc_to_posix(int aq_ret, int aq_rc) if (aq_ret == IAVF_ERR_ADMIN_QUEUE_TIMEOUT) return -EAGAIN; - if (!((u32)aq_rc < (sizeof(aq_to_posix) / sizeof((aq_to_posix)[0])))) + if (aq_rc >= ARRAY_SIZE(aq_to_posix)) return -ERANGE; return aq_to_posix[aq_rc]; -- 2.34.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3 net-next] net/intel: Replace manual array size calculation with ARRAY_SIZE 2026-04-28 10:36 ` [PATCH v3 net-next] net/intel: Replace manual array size calculation with ARRAY_SIZE Jakub Raczynski @ 2026-04-28 14:06 ` Przemek Kitszel 2026-04-28 14:59 ` Dan Carpenter 2026-04-28 15:01 ` Dan Carpenter 0 siblings, 2 replies; 6+ messages in thread From: Przemek Kitszel @ 2026-04-28 14:06 UTC (permalink / raw) To: Jakub Raczynski Cc: netdev, kuba, intel-wired-lan, linux-kernel, kernel-janitors, error27 On 4/28/26 12:36, Jakub Raczynski wrote: > There are still places in the code where manual calculation of array size > exist, but it is good to enforce usage of single macro through the whole > code as it makes code bit more readable. > While at it, beautify condition surrounding it by reversing check and remove > unnecessary casting. > > Signed-off-by: Jakub Raczynski <j.raczynski@samsung.com> > Reviewed-by: Dan Carpenter <error27@gmail.com> thank you, Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> (next time use "iwl-next" in the title, no need to repost just for that) > --- > Link to v1/v2: > https://lore.kernel.org/kernel-janitors/20260421114029.2689961-1-j.raczynski@samsung.com/ > > Changes in v3: > - Add 'Reviewed-by' from previous thread > Changes in v2: > - Beautify code by removing excessive parentheses > - Reverse if condition to remove negation of whole check > > drivers/net/ethernet/intel/i40e/i40e_adminq.h | 2 +- > drivers/net/ethernet/intel/iavf/iavf_adminq.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.h b/drivers/net/ethernet/intel/i40e/i40e_adminq.h > index 1be97a3a86ce..dcf3baec7b73 100644 > --- a/drivers/net/ethernet/intel/i40e/i40e_adminq.h > +++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.h > @@ -109,7 +109,7 @@ static inline int i40e_aq_rc_to_posix(int aq_ret, int aq_rc) > -EFBIG, /* I40E_AQ_RC_EFBIG */ > }; > > - if (!((u32)aq_rc < (sizeof(aq_to_posix) / sizeof((aq_to_posix)[0])))) > + if (aq_rc >= ARRAY_SIZE(aq_to_posix)) > return -ERANGE; > > return aq_to_posix[aq_rc]; > diff --git a/drivers/net/ethernet/intel/iavf/iavf_adminq.h b/drivers/net/ethernet/intel/iavf/iavf_adminq.h > index bbf5c4b3a2ae..dd2f61172157 100644 > --- a/drivers/net/ethernet/intel/iavf/iavf_adminq.h > +++ b/drivers/net/ethernet/intel/iavf/iavf_adminq.h > @@ -113,7 +113,7 @@ static inline int iavf_aq_rc_to_posix(int aq_ret, int aq_rc) > if (aq_ret == IAVF_ERR_ADMIN_QUEUE_TIMEOUT) > return -EAGAIN; > > - if (!((u32)aq_rc < (sizeof(aq_to_posix) / sizeof((aq_to_posix)[0])))) > + if (aq_rc >= ARRAY_SIZE(aq_to_posix)) > return -ERANGE; > > return aq_to_posix[aq_rc]; ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 net-next] net/intel: Replace manual array size calculation with ARRAY_SIZE 2026-04-28 14:06 ` Przemek Kitszel @ 2026-04-28 14:59 ` Dan Carpenter 2026-04-28 15:01 ` Dan Carpenter 1 sibling, 0 replies; 6+ messages in thread From: Dan Carpenter @ 2026-04-28 14:59 UTC (permalink / raw) To: Przemek Kitszel Cc: Jakub Raczynski, netdev, kuba, intel-wired-lan, linux-kernel, kernel-janitors On Tue, Apr 28, 2026 at 04:06:48PM +0200, Przemek Kitszel wrote: > On 4/28/26 12:36, Jakub Raczynski wrote: > > There are still places in the code where manual calculation of array size > > exist, but it is good to enforce usage of single macro through the whole > > code as it makes code bit more readable. > > While at it, beautify condition surrounding it by reversing check and remove > > unnecessary casting. > > > > Signed-off-by: Jakub Raczynski <j.raczynski@samsung.com> > > Reviewed-by: Dan Carpenter <error27@gmail.com> > > thank you, > Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> > > (next time use "iwl-next" in the title, no need to repost just for that) > These prefixes are a headache. It seems like no big deal if you only work on one subsystem, but if you're dealing with tree wide code then we're dealing with 418 trees. These days I have a script for net and net-next because they are a high volume list and the original prefix subsystem. But otherwise it just automatically puts [PATCH next] if it's in linux-next or [PATCH] if it's in Linus's tree. These are all automatic on my end, right? So it would be totally possible to automate in the recieving side instead. Although in this case, my script would net-next in the subject because I had no idea that Intel was managing their own ethernet drivers... It used to be that wireless had their own tree and everything else went through net. So it's just seems like a in impossible task to keep track of it all even if you are not a newbie. :/ regards, dan carpenter ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 net-next] net/intel: Replace manual array size calculation with ARRAY_SIZE 2026-04-28 14:06 ` Przemek Kitszel 2026-04-28 14:59 ` Dan Carpenter @ 2026-04-28 15:01 ` Dan Carpenter 2026-04-29 9:01 ` Przemek Kitszel 1 sibling, 1 reply; 6+ messages in thread From: Dan Carpenter @ 2026-04-28 15:01 UTC (permalink / raw) To: Przemek Kitszel Cc: Jakub Raczynski, netdev, kuba, intel-wired-lan, linux-kernel, kernel-janitors On Tue, Apr 28, 2026 at 04:06:48PM +0200, Przemek Kitszel wrote: > On 4/28/26 12:36, Jakub Raczynski wrote: > > There are still places in the code where manual calculation of array size > > exist, but it is good to enforce usage of single macro through the whole > > code as it makes code bit more readable. > > While at it, beautify condition surrounding it by reversing check and remove > > unnecessary casting. > > > > Signed-off-by: Jakub Raczynski <j.raczynski@samsung.com> > > Reviewed-by: Dan Carpenter <error27@gmail.com> > > thank you, > Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> > > (next time use "iwl-next" in the title, no need to repost just for that) > Which sub directories go through iwl-next? I was trying to update my script > > > > drivers/net/ethernet/intel/i40e/i40e_adminq.h | 2 +- > > drivers/net/ethernet/intel/iavf/iavf_adminq.h | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) but look at these file names. There is no "iwl" anywhere in the names! :( regards, dan carpenter ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 net-next] net/intel: Replace manual array size calculation with ARRAY_SIZE 2026-04-28 15:01 ` Dan Carpenter @ 2026-04-29 9:01 ` Przemek Kitszel 2026-04-29 10:24 ` Dan Carpenter 0 siblings, 1 reply; 6+ messages in thread From: Przemek Kitszel @ 2026-04-29 9:01 UTC (permalink / raw) To: Dan Carpenter Cc: Jakub Raczynski, netdev, kuba, intel-wired-lan, linux-kernel, kernel-janitors On 4/28/26 17:01, Dan Carpenter wrote: > On Tue, Apr 28, 2026 at 04:06:48PM +0200, Przemek Kitszel wrote: >> On 4/28/26 12:36, Jakub Raczynski wrote: >>> There are still places in the code where manual calculation of array size >>> exist, but it is good to enforce usage of single macro through the whole >>> code as it makes code bit more readable. >>> While at it, beautify condition surrounding it by reversing check and remove >>> unnecessary casting. >>> >>> Signed-off-by: Jakub Raczynski <j.raczynski@samsung.com> >>> Reviewed-by: Dan Carpenter <error27@gmail.com> >> >> thank you, >> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> >> >> (next time use "iwl-next" in the title, no need to repost just for that) >> > > Which sub directories go through iwl-next? I was trying to update > my script Thank you for all the patches so far you have provided and willingness to continue. F: Documentation/networking/device_drivers/ethernet/intel/ F: drivers/net/ethernet/intel/ F: drivers/net/ethernet/intel/*/ F: include/linux/avf/virtchnl.h F: include/linux/net/intel/*/ Perhaps instead of you managing your script, and everybody else doing the same, there could be some extension added to MAINTAINERS file to encode the prefix? In our case, the prefix itself is a message for net maintainers: iwl or iwl-next means the patch will go first via our tree, and be sent later as a PR for net/net-next. Without the prefix it requires guessing what was the submitter intent. Most patches that go through IWL receive additional round of testing on real HW too, thanks to our VAL. Patches that go straight to net are just merged faster. As intel ethernet maintainer, I want our code tested more, instead of merged faster (in most cases). > >>> >>> drivers/net/ethernet/intel/i40e/i40e_adminq.h | 2 +- >>> drivers/net/ethernet/intel/iavf/iavf_adminq.h | 2 +- >>> 2 files changed, 2 insertions(+), 2 deletions(-) > > but look at these file names. There is no "iwl" anywhere in > the names! :( > > regards, > dan carpenter > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 net-next] net/intel: Replace manual array size calculation with ARRAY_SIZE 2026-04-29 9:01 ` Przemek Kitszel @ 2026-04-29 10:24 ` Dan Carpenter 0 siblings, 0 replies; 6+ messages in thread From: Dan Carpenter @ 2026-04-29 10:24 UTC (permalink / raw) To: Przemek Kitszel Cc: Jakub Raczynski, netdev, kuba, intel-wired-lan, linux-kernel, kernel-janitors On Wed, Apr 29, 2026 at 11:01:46AM +0200, Przemek Kitszel wrote: > F: Documentation/networking/device_drivers/ethernet/intel/ > F: drivers/net/ethernet/intel/ > F: drivers/net/ethernet/intel/*/ > F: include/linux/avf/virtchnl.h > F: include/linux/net/intel/*/ > Fine. Thanks. I can add this. > Perhaps instead of you managing your script, and everybody else doing > the same, there could be some extension added to MAINTAINERS file to > encode the prefix? > > In our case, the prefix itself is a message for net maintainers: > iwl or iwl-next means the patch will go first via our tree, and be sent > later as a PR for net/net-next. > > Without the prefix it requires guessing what was the submitter intent. We don't have any intent. So long as it gets merged who cares how it happens? > Most patches that go through IWL receive additional round of testing on > real HW too, thanks to our VAL. > Patches that go straight to net are just merged faster. > As intel ethernet maintainer, I want our code tested more, instead of > merged faster (in most cases). All of this scripting could be done on your end. No matter how many dozens of people you educate to add a different prefix it's always going to be less reliable than just scripting it on your side. Anyway, here is the relevant bit from my script. The other subsystem that requires these is BPF but I only send bug reports for BPF issues. You also need to do a git fetch of all the trees with subsystem rules. regards, dan carpenter # Is this networking? if grep -q netdev $MAIL_FILE && ! grep -q wireless $MAIL_FILE ; then if [ "$FIXES_COMMIT" != "" ] ; then if git merge-base --is-ancestor $FIXES_COMMIT net/main ; then TREE="net" elif git merge-base --is-ancestor $FIXES_COMMIT net-next/main ; then TREE="net-next" else TREE="net-other" fi else TREE="net-next" fi fi # Is this Intel Wireless if grep -q -w /iwlwifi/ $MAIL_FILE ; then if [ "$FIXES_COMMIT" != "" ] ; then if git merge-base --is-ancestor $FIXES_COMMIT iwlwifi/fixes ; then TREE="iwlwifi" elif git merge-base --is-ancestor $FIXES_COMMIT iwlwifi/next ; then TREE="iwlwifi-next" else TREE="iwlwifi-other" fi else TREE="iwlwifi-next" fi fi # Otherwise if the commit is only required in next then put [PATCH next] # in the subject. if [ "$TREE" == "" ] ; then if [ "$FIXES_COMMIT" != "" ] ; then if ! git merge-base --is-ancestor $FIXES_COMMIT origin/master ; then TREE="next" fi fi fi ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-04-29 10:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20260428103757eucas1p132f3f1123fae21d596a51cbdce72c931@eucas1p1.samsung.com>
2026-04-28 10:36 ` [PATCH v3 net-next] net/intel: Replace manual array size calculation with ARRAY_SIZE Jakub Raczynski
2026-04-28 14:06 ` Przemek Kitszel
2026-04-28 14:59 ` Dan Carpenter
2026-04-28 15:01 ` Dan Carpenter
2026-04-29 9:01 ` Przemek Kitszel
2026-04-29 10:24 ` Dan Carpenter
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox