From: Eduardo Valentin <eduardo.valentin@ti.com>
To: Shawn Guo <shawn.guo@linaro.org>
Cc: linux-pm@vger.kernel.org, Zhang Rui <rui.zhang@intel.com>,
Eduardo Valentin <eduardo.valentin@ti.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] thermal: thermal_core: policy store via sysfs is broken
Date: Mon, 3 Jun 2013 10:59:36 -0400 [thread overview]
Message-ID: <51ACAF58.9060301@ti.com> (raw)
In-Reply-To: <1370267943-13297-1-git-send-email-shawn.guo@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 1624 bytes --]
Shawn,
On 03-06-2013 09:59, Shawn Guo wrote:
> When function __find_governor() gets called from policy_store(), the
> argument 'buf' has a '\n' character at the end. This causes strnicmp()
> mismatches all the time. Consequently, policy_store() will always
> return -EINVAL, and hence the policy store via sysfs will always fail
> even when users store a correct policy name.
>
> Fix the problem by using strncasecmp() for policy name matching in
> __find_governor().
>
Thanks for your patch, but Andy has fixed this issue already here:
http://git.kernel.org/cgit/linux/kernel/git/rzhang/linux.git/commit/?h=next&id=42a5bf507d7f7ecbf606eb392dd9d2e4d009c36b
Patch is present in thermal/next.
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
> drivers/thermal/thermal_core.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index d755440..6ba869f 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -57,9 +57,10 @@ static struct thermal_governor *__find_governor(const char *name)
> {
> struct thermal_governor *pos;
>
> - list_for_each_entry(pos, &thermal_governor_list, governor_list)
> - if (!strnicmp(name, pos->name, THERMAL_NAME_LENGTH))
> + list_for_each_entry(pos, &thermal_governor_list, governor_list) {
> + if (!strncasecmp(name, pos->name, strlen(pos->name)))
> return pos;
> + }
>
> return NULL;
> }
>
--
You have got to be excited about what you are doing. (L. Lamport)
Eduardo Valentin
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 295 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: eduardo.valentin@ti.com (Eduardo Valentin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] thermal: thermal_core: policy store via sysfs is broken
Date: Mon, 3 Jun 2013 10:59:36 -0400 [thread overview]
Message-ID: <51ACAF58.9060301@ti.com> (raw)
In-Reply-To: <1370267943-13297-1-git-send-email-shawn.guo@linaro.org>
Shawn,
On 03-06-2013 09:59, Shawn Guo wrote:
> When function __find_governor() gets called from policy_store(), the
> argument 'buf' has a '\n' character at the end. This causes strnicmp()
> mismatches all the time. Consequently, policy_store() will always
> return -EINVAL, and hence the policy store via sysfs will always fail
> even when users store a correct policy name.
>
> Fix the problem by using strncasecmp() for policy name matching in
> __find_governor().
>
Thanks for your patch, but Andy has fixed this issue already here:
http://git.kernel.org/cgit/linux/kernel/git/rzhang/linux.git/commit/?h=next&id=42a5bf507d7f7ecbf606eb392dd9d2e4d009c36b
Patch is present in thermal/next.
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
> drivers/thermal/thermal_core.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index d755440..6ba869f 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -57,9 +57,10 @@ static struct thermal_governor *__find_governor(const char *name)
> {
> struct thermal_governor *pos;
>
> - list_for_each_entry(pos, &thermal_governor_list, governor_list)
> - if (!strnicmp(name, pos->name, THERMAL_NAME_LENGTH))
> + list_for_each_entry(pos, &thermal_governor_list, governor_list) {
> + if (!strncasecmp(name, pos->name, strlen(pos->name)))
> return pos;
> + }
>
> return NULL;
> }
>
--
You have got to be excited about what you are doing. (L. Lamport)
Eduardo Valentin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 295 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130603/85efb595/attachment.sig>
next prev parent reply other threads:[~2013-06-03 15:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-03 13:59 [PATCH] thermal: thermal_core: policy store via sysfs is broken Shawn Guo
2013-06-03 13:59 ` Shawn Guo
2013-06-03 14:59 ` Eduardo Valentin [this message]
2013-06-03 14:59 ` Eduardo Valentin
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=51ACAF58.9060301@ti.com \
--to=eduardo.valentin@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=rui.zhang@intel.com \
--cc=shawn.guo@linaro.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.