[cocci] [PATCH v1 0/1] scripts/coccinelle: Add script for using ARRAY_END()
Alejandro Colomar <[email protected]> Fri, 6 Mar 2026 00:20:12 +0100
| Newsgroups | fr.inria.cocci |
|---|---|
| Message-ID | <[email protected]> |
Hi! This is a script to help find and replace uses of ARRAY_SIZE() to find the end of an array (a pointer one past the last element). We already replaced some uses a few months ago, fixing some bugs while doing that, and now I've written a coccinelle patch to do it elsewhere. This is the first time I write a script under scripts/coccinelle/, so take it with a grain of salt. I've tested it, and I see no false positives. However, I've found several false negatives (for example, in macros, or where the argument is a struct member). Have a lovely night! Alex Alejandro Colomar (1): scripts/coccinelle: Add script for using ARRAY_END() scripts/coccinelle/misc/array_end.cocci | 93 +++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 scripts/coccinelle/misc/array_end.cocci Range-diff against v0: -: -------- > 1: f1c9dff5 scripts/coccinelle: Add script for using ARRAY_END() -- 2.53.0