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: <597798313.18813704.1677352621708.JavaMail.zimbra@inria.fr>
Date:   Sat, 25 Feb 2023 20:17:01 +0100 (CET)
From:   Julia Lawall <julia.lawall@...ia.fr>
To:     Deepak R Varma <drv@...lo.com>
Cc:     nicolas palix <nicolas.palix@...g.fr>, cocci <cocci@...ia.fr>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Saurabh Singh Sengar <ssengar@...rosoft.com>,
        Praveen Kumar <kumarpraveen@...ux.microsoft.com>
Subject: Re: [PATCH] coccinelle: put_device: Include of_node_put to avoid
 false positives

> The node reference increased by of_find_device_by_node() can also be
> released by using a call to of_node_put(). Hence when this exists, the
> script should not trigger a warning, which otherwise will be a false
> positive.

Could you explain more about why of_node_put is sufficient?

thanks,
julia

> Also, improve the warning message to include of_node_put too is missing.
> 
> Signed-off-by: Deepak R Varma <drv@...lo.com>
> ---
> scripts/coccinelle/free/put_device.cocci | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/coccinelle/free/put_device.cocci
> b/scripts/coccinelle/free/put_device.cocci
> index f09f1e79bfa6..259195b501aa 100644
> --- a/scripts/coccinelle/free/put_device.cocci
> +++ b/scripts/coccinelle/free/put_device.cocci
> @@ -18,8 +18,10 @@ type T,T1,T2,T3;
> 
> id = of_find_device_by_node@p1(x)
> ... when != e = id
> +    when != of_node_put(x)
> if (id == NULL || ...) { ... return ...; }
> ... when != put_device(&id->dev)
> +    when != of_node_put(x)
>     when != platform_device_put(id)
>     when != if (id) { ... put_device(&id->dev) ... }
>     when != e1 = (T)id
> @@ -42,7 +44,7 @@ p2 << search.p2;
> @@
> 
> coccilib.report.print_report(p2[0],
> -                             "ERROR: missing put_device; call
> of_find_device_by_node on line "
> +                             "ERROR: missing put_device or of_node_put; call
> of_find_device_by_node on line "
>                              + p1[0].line
>                              + ", but without a corresponding object release within this function.")
> 
> --
> 2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ