lkml.org 
[lkml]   [2020]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] coccinelle: misc: Add array_size_dup script to detect missed overflow checks
From
Date
I propose once more to avoid a typo in the previous patch subject.



> (
> - size = E1 * E2;
> + size = array_size(E1, E2);
> |
> - size = E1 * E2 * E3;
> + size = array3_size(E1, E2, E3);
> |
> - size = E1 * E2 + E3;
> + size = struct_size(E1, E2, E3);
> )

How do you think about to use SmPL disjunctions like the following?

size =
(
- (E1) * (E2)
+ array_size(E1, E2)
|
- (E1) * (E2) * (E3)
+ array3_size(E1, E2, E3)
|
- (E1) * (E2) + (E3)
+ struct_size(E1, E2, E3)
);


> ... when != size = E4
> when != size += E4


Can it become helpful to express a constraint for a metavariable of
the type “assignment operator”?


> (
> * size = E1 * E2;@p
> |
> * size = E1 * E2 * E3;@p
> |
> * size = E1 * E2 + E3;@p
> )

*size =@p \( (E1) * (E2) \| (E1) * (E2) * (E3) \| (E1) * (E2) + (E3) \)

Regards,
Markus

\
 
 \ /
  Last update: 2020-06-17 16:37    [W:0.029 / U:1.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site