Re: [Cocci] [PATCH v3] coccinelle: misc: add array_size_dup script to detect missed overflow checks

2020-06-22 Thread Julia Lawall
On Mon, 22 Jun 2020, Denis Efremov wrote: > What do you think about removing duplicates warning from the rule? > > I mean this kind of warnings: "WARNING: same array_size (line {p1[0].line})" > > As for now, I think it's better to not disturb developers with this kind > of things. I agree. I

Re: [Cocci] [PATCH v3] coccinelle: misc: add array_size_dup script to detect missed overflow checks

2020-06-22 Thread Denis Efremov
What do you think about removing duplicates warning from the rule? I mean this kind of warnings: "WARNING: same array_size (line {p1[0].line})" As for now, I think it's better to not disturb developers with this kind of things. Thanks, Denis >> +@as_dup@ >> +expression subE1 <= as.E1; >>

Re: [Cocci] [PATCH v3] coccinelle: misc: add array_size_dup script to detect missed overflow checks

2020-06-22 Thread Denis Efremov
On 6/21/20 11:56 PM, Julia Lawall wrote: > Is it a python 2 vs python 3 thing? Yes, python2 is no longer supported and I thought it would be safe to use this syntax. Ok, I will make it portable in v4. Denis ___ Cocci mailing list

Re: [Cocci] [PATCH v3] coccinelle: misc: add array_size_dup script to detect missed overflow checks

2020-06-21 Thread Julia Lawall
> +@script:python depends on report@ > +p1 << as_next.p1; > +p2 << as_next.p2; > +@@ > + > +coccilib.report.print_report(p1[0], > +f"WARNING: array_size is used down the code (line {p2[0].line}) to compute > the same size") I get python failures for all of these messages. I know nothing about

Re: [Cocci] [PATCH v3] coccinelle: misc: add array_size_dup script to detect missed overflow checks

2020-06-21 Thread Julia Lawall
> +@as_next@ > +expression subE1 <= as.E1; > +expression subE2 <= as.E2; > +expression as.E1, as.E2, E3; > +assignment operator aop; > +position p1, p2; > +@@ > + > +* E1 * E2@p1 > + ... when != \(E1\|E2\|subE1\|subE2\) aop E3 > + when != &\(E1\|E2\|subE1\|subE2\) You don't need E1 and E2

[Cocci] [PATCH v3] coccinelle: misc: add array_size_dup script to detect missed overflow checks

2020-06-19 Thread Denis Efremov
Detect an opencoded expression that is used before or after array_size()/array3_size()/struct_size() to compute the same size. Cc: Gustavo A. R. Silva Cc: Kees Cook Signed-off-by: Denis Efremov --- Changes in v2: - python rules moved next to SmPL patterns - assignment operator used -