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

Alejandro Colomar <[email protected]>
Newsgroups org.kernel.vger.kernel-janitors,fr.inria.cocci,org.kernel.vger.linux-kernel
Message-ID <aa677-Ag_KU8QHjh@devuan>
Hi Julia,

On 2026-03-09T13:21:23+0100, Julia Lawall wrote:
[...]
> > > > +// Confidence: ???
> > >
> > > I hope that a more reasonable value can be determined for this information.
> >
> > I don't know how the scale works.  I know the script has a few false
> > negatives, and AFAIK there are no false positives.  To what level of
> > confidence would that belong?
> 
> Probably high would be fine.  The goal is mostly to indiacte whether the
> results are most likely correct or whether they will require a lot of
> study to know if everything is ok.

Thanks!  I've put high with a comment about the false negatives.

[...]
> > > > +// Comments:
> > >
> > > Please omit such an empty field.
> >
> > Ok; thanks!
> >
> > $ grep -rh '^// Comments:' scripts/coccinelle/ | sort | uniq -c
> >      34 // Comments:
> >       2 // Comments: -
> >       1 // Comments: -I ... -all_includes can give more complete results
> >       1 // Comments: Comments on code can be deleted if near code that is removed.
> >       1 // Comments: Some false positives on empty default cases in switch statements.
> >       1 // Comments: requires at least Coccinelle 0.2.4, lex or parse error otherwise
> > $ find scripts/coccinelle/ -type f | wc -l
> > 76
> >
> >
> > It seems around half of the existing scripts have that.  You may want to
> > remove those empty comments.  I added it because the scripts I looked at
> > do have it.
> 
> I don't require taht an empty comments field be removed.

Ok.

> > > …
> > > > +@i@
> > > > +@@
> > > > +
> > > > +#include <linux/kernel.h>
> > >
> > > I doubt that such an SmPL rule would be required.
> >
> > Okay, I'll remove it.  Thanks!
> 
> I'm lacking context.  You maye need this if the file doesn't already have
> it.  But it is hard to know if it could be include indirectly...

Hmmm, this macro is defined together with ARRAY_SIZE() in
<linux/array_size.h>.  I guess even if a file isn't including that
already (including indirectly), it would do well in including it for
using the macro, so I guess it's okay to remove it here.

The only concern would be files that *can't* possibly include it (maybe
tools/?).


> julia

Cheers,
Alex

-- 
<https://www.alejandro-colomar.es>
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEES7Jt9u9GbmlWADAi64mZXMKQwqkFAmmuvLEACgkQ64mZXMKQ
wqn6uhAAhRxwUq+7FMbWfJuKkdY+WdePvmNeYDMlxXAfzK17buNcjfTj3Z1ZzIBk
ZcuW9hxVH5UhWn5lFlSmY6+/8rmUB9K/EI2pERtbIlG7qEwOuCLxDLxuxsqyX7Yc
Tw0c7kLWDlOm9yRfrLzFiQHKzD+i8pq0XyInERaoi9rY3D7mezQ2vzb2hxtFUStt
kwnw1lvxzzLG7f47h4MfdNT/N5Cjct09rg/Smd5CkWmR135OwqcvorA2SKXUCH5s
N3ttS469atteNtxMdSYsaJkkBhUwUXMnt97l4PJp/u406Y8O0lnDvUV1zD9PrFXn
iDLl+lEJ2d1drJDXxkVbf2jvHodqCSIdPSN5jzFgUTW2UfShItCjS7hbM9SgJjmZ
5Q+4kNMRs5qWdZ2duWiOIb3vB1b1AhICEOZLlu2WL2cNRiQseWZFYYSGlCIwSRvk
xxuicHNf/w4pZvAIJCuSkbBnqbbbiDJVgFtUh28Ex22CHHIvlXGpyc7TBAT3Z3PV
Qnd5HyEoYgX8fNpYkl/tg8i06ftakB6uA6S165MiehYZ4/VyAupSyMYYzFjRIURl
2hRkrwvhAST3PNnbS91TQLljOO7U25rid+mlVP8J7v+FlJUyKIn4C438NpUmBeSD
i5y3lX+nk3J05Jq6PB4p0htMORILogUCjbY4Nu0cXzqgQxb2IfI=
=J0wJ
-----END PGP SIGNATURE-----
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.