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:   Fri, 03 Feb 2017 13:40:21 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Dmitry Torokhov <dmitry.torokhov@...il.com>,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>
Cc:     linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
        Mika Westerberg <mika.westerberg@...ux.intel.com>,
        Hans de Goede <hdegoede@...hat.com>,
        Wolfram Sang <wsa@...-dreams.de>
Subject: Re: [PATCH v5 1/4] device property: allow to constify properties

On Thu, 2017-02-02 at 17:41 -0800, Dmitry Torokhov wrote:
> There is no reason why statically defined properties should be
> modifiable,
> so let's make device_add_properties() and the rest of pset_*()
> functions to
> take const pointers to properties.
> 
> This will allow us to mark properties as const/__initconst at
> definition
> sites.
> 

Looks good to me.

FWIW:
Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

Though, nitpicks below.
 
>  static struct property_set *pset_copy_set(const struct property_set
> *pset)
>  {
> -	const struct property_entry *entry;
> +	struct property_entry *props;

Can we leave the name?
 
> -	p->properties = kcalloc(n + 1, sizeof(*entry), GFP_KERNEL);
> 
> +	p->properties = props = kcalloc(n + 1, sizeof(*props),
> GFP_KERNEL);
>  	if (!p->properties) {
>  		kfree(p);
>  		return ERR_PTR(-ENOMEM);
>  	}
>  
>  	for (i = 0; i < n; i++) {

> -		int ret = pset_copy_entry(&p->properties[i],
> +		int ret = pset_copy_entry(&props[i],
>  					  &pset->properties[i]);

Do we need these changes?

-- 
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Intel Finland Oy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ