From: Jean Delvare <jdelvare@suse.de>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Hardware Monitoring <linux-hwmon@vger.kernel.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwmon: Relax name attribute validation for new APIs
Date: Tue, 31 Jan 2017 10:07:11 +0100 [thread overview]
Message-ID: <20170131100711.4e8daaba@endymion> (raw)
In-Reply-To: <1485575389-31616-1-git-send-email-linux@roeck-us.net>
Hi Guenter, Dmitry,
On Fri, 27 Jan 2017 19:49:49 -0800, Guenter Roeck wrote:
> While invalid name attributes are really not desirable and do mess up
> libsensors, enforcing valid names has the detrimental effect of driving
> users away from using the new hardware monitoring API, especially those
> registering name attributes violating the ABI restrictions. Another
> undesirable side effect is that this violation and the resulting error
> may only be discovered some time after a conversion to the new API,
> which in turn may trigger a revert of that conversion.
>
> To solve the problem, relax validation and only issue a warning instead
> of returning an error if a name attribute violating the ABI is provided.
> This lets callers continue to provide invalid name attributes while
> notifying them about it.
>
> Many thanks are due to Dmitry Torokhov for the idea.
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/hwmon/hwmon.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
> index affff8195fff..53c54a81f7ad 100644
> --- a/drivers/hwmon/hwmon.c
> +++ b/drivers/hwmon/hwmon.c
> @@ -544,9 +544,10 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
> struct device *hdev;
> int i, j, err, id;
>
> - /* Do not accept invalid characters in hwmon name attribute */
> + /* Complain about invalid characters in hwmon name attribute */
> if (name && (!strlen(name) || strpbrk(name, "-* \t\n")))
> - return ERR_PTR(-EINVAL);
> + dev_warn(dev, "hwmon: '%s' is not a valid name attribute\n",
> + name);
May I suggest adding ", please fix"?
>
> id = ida_simple_get(&hwmon_ida, 0, 0, GFP_KERNEL);
> if (id < 0)
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Do I understand correctly that in the long run we will make it a fatal
error again?
--
Jean Delvare
SUSE L3 Support
next prev parent reply other threads:[~2017-01-31 9:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-28 3:49 [PATCH] hwmon: Relax name attribute validation for new APIs Guenter Roeck
2017-01-31 9:07 ` Jean Delvare [this message]
2017-01-31 11:53 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170131100711.4e8daaba@endymion \
--to=jdelvare@suse.de \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).