kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] replace memset by memzero_explicit
@ 2014-11-30 16:59 Julia Lawall
  2014-11-30 16:59 ` [PATCH 1/8] purgatory/sha256: " Julia Lawall
                   ` (8 more replies)
  0 siblings, 9 replies; 26+ messages in thread
From: Julia Lawall @ 2014-11-30 16:59 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: dborkman-H+wXaHxf7aLQT0dZR+AlfA,
	herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-raid-u79uwXL29TY76Z2rM5mHXA,
	dm-devel-H+wXaHxf7aLQT0dZR+AlfA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-crypto-u79uwXL29TY76Z2rM5mHXA,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-usb-u79uwXL29TY76Z2rM5mHXA

Memset on a local variable may be removed when it is called just before the
variable goes out of scope.  Using memzero_explicit defeats this
optimization.  The complete semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier x;
local idexpression e;
type T,T1;
@@

{
... when any
T x[...];
... when any
    when exists
(
e = (T1)x
|
e = (T1)&x[0]
)
... when any
    when exists
- memset
+ memzero_explicit
  (x,
-0,
  ...)
... when != x
    when != e
    when strict
}

@@
identifier i,x;
local idexpression e;
type T;
@@

{
... when any
struct i x;
... when any
    when exists
e = (T)&x
... when any
    when exists
- memset
+ memzero_explicit
  (&x,
-0,
  ...)
... when != x
    when != e
    when strict
}

// ------------------------------------------------------------------------

@@
identifier x;
type T,T1;
expression e;
@@

{
... when any
T x[...];
... when any
    when exists
    when != e = (T1)x
    when != e = (T1)&x[0]
- memset
+ memzero_explicit
  (x,
-0,
  ...)
... when != x
    when strict
}

@@
identifier i,x;
expression e;
type T;
@@

{
... when any
struct i x;
... when any
    when exists
    when != e = (T)&x
- memset
+ memzero_explicit
  (&x,
-0,
  ...)
... when != x
    when strict
}
// </smpl>


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2014-12-03  0:18 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-30 16:59 [PATCH 0/8] replace memset by memzero_explicit Julia Lawall
2014-11-30 16:59 ` [PATCH 1/8] purgatory/sha256: " Julia Lawall
2014-12-01 15:20   ` David Sterba
2014-11-30 16:59 ` [PATCH 2/8] sparc64: " Julia Lawall
2014-11-30 16:59 ` [PATCH 3/8] crypto: " Julia Lawall
     [not found] ` <1417366774-32412-1-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
2014-11-30 16:59   ` [PATCH 4/8] cifs: " Julia Lawall
2014-11-30 16:59 ` [PATCH 5/8] dm: " Julia Lawall
2014-11-30 16:59 ` [PATCH 6/8] crypto: " Julia Lawall
2014-11-30 16:59 ` [PATCH 7/8] " Julia Lawall
2014-11-30 16:59 ` [PATCH 8/8] wusb: " Julia Lawall
2014-12-03  0:14   ` Greg Kroah-Hartman
2014-12-03  0:18     ` Daniel Borkmann
2014-11-30 17:03 ` [PATCH 0/8] " Julia Lawall
2014-11-30 17:03   ` [PATCH 1/8 v2] purgatory/sha256: " Julia Lawall
2014-11-30 17:03   ` [PATCH 2/8 v2] sparc64: " Julia Lawall
2014-12-02 14:58     ` Herbert Xu
2014-11-30 17:03   ` [PATCH 3/8 v2] crypto: " Julia Lawall
2014-11-30 17:03   ` [PATCH 4/8 v2] cifs: " Julia Lawall
2014-11-30 17:03   ` [PATCH 5/8 v2] dm: " Julia Lawall
2014-12-01 21:03     ` Milan Broz
2014-12-01 23:00       ` Mike Snitzer
2014-11-30 17:03   ` [PATCH 6/8 v2] crypto: " Julia Lawall
2014-12-01  0:58     ` Michael Ellerman
2014-11-30 17:03   ` [PATCH 7/8 " Julia Lawall
2014-11-30 19:57     ` Ard Biesheuvel
2014-11-30 17:03   ` [PATCH 8/8 v2] wusb: " Julia Lawall

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).