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]
Date:   Mon, 21 Aug 2023 13:49:20 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Rob Herring <robh@...nel.org>
Cc:     Frank Rowand <frowand.list@...il.com>,
        "Enrico Weigelt, metux IT consult" <info@...ux.net>,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Petr Mladek <pmladek@...e.com>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 5/6] of: dynamic: Move dead property list check into
 property add/update functions

On Fri, Aug 18, 2023 at 03:41:00PM -0500, Rob Herring wrote:
> The changeset code checks for a property in the deadprops list when
> adding/updating a property, but of_add_property() and
> of_update_property() do not. As the users of these functions are pretty
> simple, they have not hit this scenario or else the property lists
> would get corrupted.
> 
> With this there are 3 cases of removing a property from either deadprops
> or properties lists, so add a helper to find and remove a matching
> property.

...

> v3:
>  - Keep existing style in deadprops loop

Not sure where exactly in the code that one, but...

...

>  int __of_remove_property(struct device_node *np, struct property *prop)
>  {
> -	struct property **next;
> -
> -	for (next = &np->properties; *next; next = &(*next)->next) {
> -		if (*next == prop)
> -			break;
> +	if (__of_remove_property_from_list(&np->properties, prop)) {
> +		/* Found the property, add it to deadprops list */
> +		prop->next = np->deadprops;
> +		np->deadprops = prop;
> +		return 0;
>  	}
> -	if (*next == NULL)
> -		return -ENODEV;
> -
> -	/* found the node */
> -	*next = prop->next;
> -	prop->next = np->deadprops;
> -	np->deadprops = prop;
>  
> -	return 0;
> +	return -ENODEV;
>  }


...if it's this one, I don't see how it's better than

	if (!__of_remove_property_from_list(&np->properties, prop))
		return -ENODEV;

	/* Found the property, add it to deadprops list */
	prop->next = np->deadprops;
	np->deadprops = prop;
	return 0;

Note, with --patience in use it may produce even nice-looking diff.

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ