Messages in this thread |  | | Date | Mon, 9 Mar 2026 12:17:00 +0100 | | Subject | Re: [cocci] [PATCH] scripts/coccinelle: Add script for using ARRAY_END() | | From | Markus Elfring <> |
| |
… > This script makes it easy to find more places where that macro should be > used.
See also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v7.0-rc3#n94
… > +++ b/scripts/coccinelle/misc/array_end.cocci > @@ -0,0 +1,93 @@ …
> +// Confidence: ???
I hope that a more reasonable value can be determined for this information.
… > +// Comments:
Please omit such an empty field.
… > +@i@ > +@@ > + > +#include <linux/kernel.h>
I doubt that such an SmPL rule would be required.
> + > +//---------------------------------------------------------- > +// For context mode > +//---------------------------------------------------------- > +
Please omit such extra comment lines.
> +@depends on i&&context@ > +type T; > +T[] a; > +expression b; > +@@ > +( > +* (a + ARRAY_SIZE(a)) > +| > +* (&a[0] + ARRAY_SIZE(a)) > +| > +* (&a[ARRAY_SIZE(a)]) > +| > +* (&a[ARRAY_SIZE(a) - b]) > +)
Extra space characters may be omitted directly after SmPL asterisks.
… > +@r depends on (org || report)@
You may omit parentheses here.
… > +@script:python depends on report@ > +p << r.p; > +@@ > + > +msg="WARNING: Use ARRAY_END" > +coccilib.report.print_report(p[0], msg)
Would the following command variant be a bit nicer?
coccilib.report.print_report(p[0], "WARNING: opportunity for ARRAY_END()")
By the way: How do you think about to omit a cover letter for a single patch?
Regards, Markus
|  |