From: Julia Lawall <Julia.Lawall@lip6.fr>
To: David Airlie <airlied@linux.ie>
Cc: kernel-janitors@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] initialize all fields
Date: Mon, 30 Jan 2012 12:05:54 +0100 [thread overview]
Message-ID: <1327921555-7862-1-git-send-email-Julia.Lawall@lip6.fr> (raw)
This patch fixes a case where a structure field is not initialized before
the structureis copied to user level.
The semantic match that finds this problem is as follows
(http://coccinelle.lip6.fr/). It uses other references to the same
structure in the current file to find the set of fields that should be
initialized.
@a disable decl_init@
identifier x,x1;
type T,T1;
expression e,sz;
@@
T x;
... when any
copy_to_user(e,&x,sz)
@r@
a.T y;
identifier f,f1,f2;
@@
(
y.f1[...]
|
y.f1.f2
|
y.f
)
@b@
identifier a.x,r.f;
type a.T;
expression e,e1,sz;
position p,p0;
@@
T x@p0;
... when != x.f = e1
when != &x
when != &(x.f)
when != get_user(x.f,...)
when != __get_user(x.f,...)
when != x = e1
copy_to_user@p(e,&x,sz)
@script:ocaml@
t << a.T;
x << a.x;
f << r.f;
p << b.p;
@@
Printf.printf "%s:%d: %s %s missing %s\n" (List.hd p).file (List.hd p).line
t x f
next reply other threads:[~2012-01-30 11:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-30 11:05 Julia Lawall [this message]
2012-01-30 11:05 ` [PATCH] drivers/gpu/drm/drm_ioc32.c: initialize all fields Julia Lawall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1327921555-7862-1-git-send-email-Julia.Lawall@lip6.fr \
--to=julia.lawall@lip6.fr \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).