lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1604171337450.2034@localhost6.localdomain6>
Date:	Sun, 17 Apr 2016 13:39:01 +0200 (CEST)
From:	Julia Lawall <julia.lawall@...6.fr>
To:	Joe Perches <joe@...ches.com>
cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Andy Whitcroft <apw@...dowen.org>,
	linux-kernel@...r.kernel.org, Davidlohr Bueso <dbueso@...e.de>,
	Davidlohr Bueso <dave@...olabs.net>
Subject: Re: [PATCH] checkpatch: Whine about ACCESS_ONCE

A suitably versatile semantic patch is below.  Feel free to update 
at 
least the copyright line, and perhaps the initial explanation and the 
strings printed in report and org modes.

julia

/// Use READ_ONCE or WRITE_ONCE instead of ACCESS_ONCE.
///
// Confidence: High
// Copyright: (C) 2016 Joe Perches, afffiliation?, license?
// Options: --no-includes --include-headers

virtual patch
virtual context
virtual org
virtual report

@written depends on patch && !context && !org && !report@
expression e1;
expression e2;
@@

-       ACCESS_ONCE(e1) = e2
+       WRITE_ONCE(e1, e2)

@read depends on patch && !context && !org && !report@
expression e1;
@@

-       ACCESS_ONCE(e1)
+       READ_ONCE(e1)

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

@written_context depends on !patch && (context || org || report)@
expression e1, e2;
position j0;
@@

*        ACCESS_ONCE@j0(e1) = e2

@read_context depends on !patch && (context || org || report)@
expression e1;
position j0;
@@

*        ACCESS_ONCE@j0(e1)

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

@script:python written_org depends on org@
j0 << written_context.j0;
@@

msg = "Use WRITE_ONCE for an ACCESS_ONCE that is written."
coccilib.org.print_todo(j0[0], msg, color="ovl-face2")

@script:python read_org depends on org@
j0 << read_context.j0;
@@

msg = "Use READ_ONCE for an ACCESS_ONCE that is read."
coccilib.org.print_todo(j0[0], msg)

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

@script:python written_report depends on report@
j0 << written_context.j0;
@@

msg = "Use WRITE_ONCE for an ACCESS_ONCE that is written."
coccilib.report.print_report(j0[0], msg)

@script:python read_report depends on report@
j0 << read_context.j0;
@@

msg = "Use READ_ONCE for an ACCESS_ONCE that is read."
coccilib.report.print_report(j0[0], msg)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ