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.1208211105300.1984@hadrien>
Date:	Tue, 21 Aug 2012 11:06:35 +0200 (CEST)
From:	Julia Lawall <julia.lawall@...6.fr>
To:	Lars-Peter Clausen <lars@...afoo.de>
cc:	Julia Lawall <julia@...u.dk>, linux-kernel@...r.kernel.org,
	cocci@...u.dk, Michal Marek <mmarek@...e.cz>
Subject: Re: [Cocci] [PATCH] scripts/coccinelle: ptr_ret: Add ternary operator
 version



On Tue, 21 Aug 2012, Lars-Peter Clausen wrote:

> Add a ternary operator version of the open-coded PTR_RET().
>
> Signed-off-by: Lars-Peter Clausen <lars@...afoo.de>
> ---
>  scripts/coccinelle/api/ptr_ret.cocci |   26 ++++++++++++++++++++++++++
>  1 files changed, 26 insertions(+), 0 deletions(-)
>
> diff --git a/scripts/coccinelle/api/ptr_ret.cocci b/scripts/coccinelle/api/ptr_ret.cocci
> index cbfd08c..15f076f 100644
> --- a/scripts/coccinelle/api/ptr_ret.cocci
> +++ b/scripts/coccinelle/api/ptr_ret.cocci
> @@ -30,6 +30,13 @@ expression ptr;
>  - if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0;
>  + return PTR_RET(ptr);
>
> +@...ends on patch@
> +expression ptr;
> +@@
> +
> +- (IS_ERR(ptr) ? PTR_ERR(ptr) : 0)
> ++ PTR_RET(ptr)
> +
>  @r1 depends on !patch@
>  expression ptr;
>  position p1;
> @@ -44,6 +51,13 @@ position p2;
>
>  * if@p2 (IS_ERR(ptr)) return PTR_ERR(ptr); return 0;
>
> +@r3 depends on !patch@
> +expression ptr;
> +position p3;
> +@@
> +
> +* IS_ERR@p3(ptr) ? PTR_ERR(ptr) : 0
> +
>  @script:python depends on org@
>  p << r1.p1;
>  @@
> @@ -57,6 +71,12 @@ p << r2.p2;
>
>  coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used")
>
> +@...ipt:python depends on org@
> +p << r3.p3;
> +@@
> +
> +coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used")
> +
>  @script:python depends on report@
>  p << r1.p1;
>  @@
> @@ -68,3 +88,9 @@ p << r2.p2;
>  @@
>
>  coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used")
> +
> +@...ipt:python depends on report@
> +p << r3.p3;
> +@@
> +
> +coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used")

Signed-off-by: Julia Lawall <Julia.Lawall@...6.fr>

> --
> 1.7.2.5
>
> _______________________________________________
> Cocci mailing list
> Cocci@...u.dk
> http://lists.diku.dk/mailman/listinfo/cocci
> (Web access from inside DIKUs LAN only)
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ