Re: [v2] scripts/coccinelle: Add script for using ARRAY_END()

Markus Elfring <[email protected]>
Newsgroups org.kernel.vger.kernel-janitors,fr.inria.cocci,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
> Here are more false negatives that I found manually.  The semantic patch
> didn't find them.

Thanks for your clarification approach.


>                    Does anyone know how we could improve it

The corresponding knowledge is evolving.


>                                                             or why it
> didn't find them?

I suggest to refine case distinctions.
Can further test cases help to achieve a better understanding for the affected data processing?


…
> 	+++ b/arch/powerpc/kernel/rtas.c
> 	@@ -555,10 +555,8 @@ static struct rtas_function rtas_function_table[] __ro_after_init = {
> 		},
> 	 };
> 	 
> 	-#define for_each_rtas_function(funcp)                                       \
> 	-       for (funcp = &rtas_function_table[0];                               \
> 	-            funcp < &rtas_function_table[ARRAY_SIZE(rtas_function_table)]; \
> 	-            ++funcp)
> 	+#define for_each_rtas_function(f)                                     \
> 	+       for (f = rtas_function_table; f < ARRAY_END(rtas_function_table); ++f)

Are there development challenges to reconsider for macro definitions?


…
> 	+++ b/drivers/net/wireless/intel/iwlwifi/mei/net.c
> 	@@ -43,7 +43,7 @@ static bool iwl_mei_rx_filter_eth(const struct ethhdr *ethhdr,
> 			return false;
> 	 
> 		for (filt = &filters->eth_filters[0];
> 	-            filt < &filters->eth_filters[0] + ARRAY_SIZE(filters->eth_filters);
> 	+            filt < ARRAY_END(filters->eth_filters);
> 		     filt++) {
> 			/* Assume there are no enabled filter after a disabled one */
> 			if (!(filt->flags & SAP_ETH_FILTER_ENABLED))

Will any loops become better supported?

Regards,
Markus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.