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] [day] [month] [year] [list]
Message-ID: <6abd97ee-b9fe-d2eb-4486-b1c43efc0e5@inria.fr>
Date: Wed, 5 Feb 2025 15:36:36 +0100 (CET)
From: Julia Lawall <julia.lawall@...ia.fr>
To: Geert Uytterhoeven <geert+renesas@...der.be>
cc: Julia Lawall <Julia.Lawall@...ia.fr>, 
    Nicolas Palix <nicolas.palix@...g.fr>, Rob Herring <robh@...nel.org>, 
    Saravana Kannan <saravanak@...gle.com>, 
    Wolfram Sang <wsa+renesas@...g-engineering.com>, cocci@...ia.fr, 
    devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH/RFC v2] coccinelle: of_table: Do not add commas after
 sentinels



On Wed, 5 Feb 2025, Geert Uytterhoeven wrote:

> It does not make sense to have a comma after a sentinel, as any new
> elements must be added before the sentinel.  Hence do not add the comma
> when adding the sentinel.
>
> Include the comma after the previous entry, else it will appear after the
> sentinel.
>
> Add a comment to clarify the purpose of the empty element.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@...der.be>
> ---
> v2:
>   - Add devicetree people.
>
> This is a patch I wrote last year.
> My original intention was to create a Coccinelle script to remove
> commas after sentinels, and annotate them, to automate the creation of
> patches like commit 0256b6aeee11d705 ("pinctrl: renesas: Annotate
> sentinels in tables").  Unfortunately I could not get that work (blame
> it on this being my first experiment with Coccinelle).  Hence I gave up,
> and instead settled for adapting the existing script to not add these
> commas in the first place...
>
> Known issues:
>
>   1. This generates patches like:
>
> 	+	{/* sentinel */}
>
>      while I would prefer to see:
>
> 	+	{ /* sentinel */ }
>
>      Is there a way to do that, or should I just post-process the
>      generated patches?

Try running with --smpl-spacing.

julia

>
>   2. If the array contains a "{ NULL }" element, this is still flagged
>      as a missing sentinel:
>
> 	-	{ NULL }
> 	+	{ NULL },
> 	+	{},
>
>      Note that this is a pre-existing issue.
> ---
>  scripts/coccinelle/misc/of_table.cocci | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci
> index 4693ea7447534144..7ade9766dee89c70 100644
> --- a/scripts/coccinelle/misc/of_table.cocci
> +++ b/scripts/coccinelle/misc/of_table.cocci
> @@ -37,15 +37,14 @@ struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{
>  	.var = E,
> --	}
> -+	},
> -+	{ }
> +	},
> ++	{ /* sentinel */ }
>  };
>  |
>  struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
>  	...,
>  	{ ..., E, ... },
> -+	{ },
> ++	{ /* sentinel */ }
>  };
>  )
>
> --
> 2.43.0
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ