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: <CAK44p22JK+DkbrTwCSU1OCkkC=sHrWeFfEmTE8Km3=dZm4T-aQ@mail.gmail.com>
Date:	Thu, 22 Mar 2012 10:40:17 +0530
From:	Amit Kachhap <amit.kachhap@...aro.org>
To:	Jean Delvare <khali@...ux-fr.org>
Cc:	linux-pm@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
	linux-acpi@...r.kernel.org, lenb@...nel.org,
	linaro-dev@...ts.linaro.org, patches@...aro.org
Subject: Re: [PATCH] thermal: Fix for setting the thermal zone mode to enable/disable

On 21 March 2012 19:43, Jean Delvare <khali@...ux-fr.org> wrote:
> On Wed, 21 Mar 2012 16:40:01 +0530, Amit Daniel Kachhap wrote:
>> Basically without this patch changing the mode of thermal zone
>> is not possible as wrong string size is passed to strncmp.
>
> Actually it is possible,
> $ echo -n disabled > mode
> works fine. But it fails without the -n, your patch would fix that.
Thanks for pointing this out. Anyway this patch makes some sense until
sysfs takes care of this.
>
> Acked-by: Jean Delvare <khali@...ux-fr.org>
>
> Note that a quick grep suggests that drivers/misc/ad525x_dpot.c,
> security/selinux/hooks.c and arch/m68k/sun3/prom/console.c suffer from
> the same issue, if you want to fix them too.
>
>> Signed-off-by: Amit Daniel Kachhap <amit.kachhap@...aro.org>
>> ---
>>  drivers/thermal/thermal_sys.c |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
>> index 220ce7e..96da1af 100644
>> --- a/drivers/thermal/thermal_sys.c
>> +++ b/drivers/thermal/thermal_sys.c
>> @@ -152,9 +152,9 @@ mode_store(struct device *dev, struct device_attribute *attr,
>>       if (!tz->ops->set_mode)
>>               return -EPERM;
>>
>> -     if (!strncmp(buf, "enabled", sizeof("enabled")))
>> +     if (!strncmp(buf, "enabled", sizeof("enabled") - 1))
>>               result = tz->ops->set_mode(tz, THERMAL_DEVICE_ENABLED);
>> -     else if (!strncmp(buf, "disabled", sizeof("disabled")))
>> +     else if (!strncmp(buf, "disabled", sizeof("disabled") - 1))
>>               result = tz->ops->set_mode(tz, THERMAL_DEVICE_DISABLED);
>>       else
>>               result = -EINVAL;
>
>
> --
> Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ