[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.22.394.2310012112560.3166@hadrien>
Date: Sun, 1 Oct 2023 21:14:02 +0200 (CEST)
From: Julia Lawall <julia.lawall@...ia.fr>
To: Kees Cook <kees@...nel.org>
cc: Julia Lawall <julia.lawall@...ia.fr>, Kees Cook <keescook@...omium.org>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Ian Abbott <abbotti@....co.uk>,
H Hartley Sweeten <hsweeten@...ionengravers.com>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>, Tom Rix <trix@...hat.com>,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
linux-hardening@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] comedi: Annotate struct comedi_lrange with
__counted_by
Kees,
You can try the following.
julia
#spatch --all-includes
@r@
identifier i,j;
type T;
@@
struct i {
...
T j[];
}
@s@
identifier r.i;
constant ini;
identifier j;
initializer list [n] is2;
position p;
identifier x;
@@
struct i@p x =
{ ...,
.j = ini,
...,
{ is2 } }
;
@script:ocaml@
ini << s.ini;
i << r.i;
j << s.j;
n << s.n;
p << s.p;
@@
try
let ini = int_of_string ini in
if n = ini
then Printf.printf "%s:%d: struct %s: field %s is the counter for the flex array\n" (List.hd p).file (List.hd p).line i j
with _-> () (* not an explicit integer *)
@s2@
identifier r.i;
constant ini;
initializer list [n] is;
initializer list [n2] is2;
position p;
identifier x;
@@
struct i@p x =
{ is,
ini,
...,
{ is2 } };
@script:ocaml@
ini << s2.ini;
i << r.i;
n << s2.n;
n2 << s2.n2;
p << s2.p;
@@
try
let ini = int_of_string ini in
if n2 = ini
then Printf.printf "%s:%d: struct %s: field at offset %d is the counter for the flex array\n" (List.hd p).file (List.hd p).line i n
with _-> () (* not an explicit integer *)
Powered by blists - more mailing lists