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: <20210319213005.GA24260@roeck-us.net>
Date:   Fri, 19 Mar 2021 14:30:05 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Chris Packham <chris.packham@...iedtelesis.co.nz>
Cc:     robh+dt@...nel.org, jdelvare@...e.com, devicetree@...r.kernel.org,
        linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/3] hwmon: (pmbus): Replace - with _ in device names
 before registration

On Wed, Mar 17, 2021 at 05:02:30PM +1300, Chris Packham wrote:
> The hwmon sysfs ABI requires that the `name` property doesn't include
> any dashes. But when the pmbus code picks the name up from the device
> tree it quite often does. Replace '-' with '_' before registering the
> device.
> 
> Signed-off-by: Chris Packham <chris.packham@...iedtelesis.co.nz>

Applied.

Thanks,
Guenter

> ---
> 
> Notes:
>     Changes in v3:
>     - None
>     Changes in v2:
>     - New
> 
>  drivers/hwmon/pmbus/pmbus_core.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index aadea85fe630..7d2f8f032314 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -2557,6 +2557,7 @@ int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info)
>  	struct pmbus_data *data;
>  	size_t groups_num = 0;
>  	int ret;
> +	char *name;
>  
>  	if (!info)
>  		return -ENODEV;
> @@ -2606,10 +2607,15 @@ int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info)
>  		return -ENODEV;
>  	}
>  
> +	name = devm_kstrdup(dev, client->name, GFP_KERNEL);
> +	if (!name)
> +		return -ENOMEM;
> +	strreplace(name, '-', '_');
> +
>  	data->groups[0] = &data->group;
>  	memcpy(data->groups + 1, info->groups, sizeof(void *) * groups_num);
>  	data->hwmon_dev = devm_hwmon_device_register_with_groups(dev,
> -					client->name, data, data->groups);
> +					name, data, data->groups);
>  	if (IS_ERR(data->hwmon_dev)) {
>  		dev_err(dev, "Failed to register hwmon device\n");
>  		return PTR_ERR(data->hwmon_dev);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ