Re: [PATCH] iio: hid-sensor-attributes: Check sample_frequency/hysteresis write data legitimacy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/11/16 17:55, Pandruvada, Srinivas wrote:
> On Thu, 2016-11-03 at 00:45 +0000, Song Hongyan wrote:
>>
>> Neither sample frequency value nor hysteresis value can be set to be
>> a
>> negative number, check and return "Invalid argument" if they are
>> negative.
>>
>> If not do this change, sample_frequency will be set into some unknown
>> value, read hysteresis value after write negative number will return
>> "Invalid argument".
>>
>> Signed-off-by: Song Hongyan <hongyan.song@xxxxxxxxx>
> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>
>From the description I'm reading this as a minor issue and not a
regression (it never worked right).  As such with Linus getting
irritated about fixes for stuff that has been long broken I'm
going to take this the slow route (i.e. next merge window).

Applied to the togreg branch of iio.git. Will be initially pushed out
as testing for the autobuilders to play with it.

Thanks,

Jonathan
> 
>>
>> ---
>>  drivers/iio/common/hid-sensors/hid-sensor-attributes.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
>> b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
>> index dc33c1d..4509f8475 100644
>> --- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
>> +++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
>> @@ -201,7 +201,7 @@ int hid_sensor_write_samp_freq_value(struct
>> hid_sensor_common *st,
>>  	int ret;
>>  
>>  	if (val1 < 0 || val2 < 0)
>> -		ret = -EINVAL;
>> +		return -EINVAL;
>>  
>>  	value = val1 * pow_10(6) + val2;
>>  	if (value) {
>> @@ -250,6 +250,9 @@ int hid_sensor_write_raw_hyst_value(struct
>> hid_sensor_common *st,
>>  	s32 value;
>>  	int ret;
>>  
>> +	if (val1 < 0 || val2 < 0)
>> +		return -EINVAL;
>> +
>>  	value = convert_to_vtf_format(st->sensitivity.size,
>>  				st->sensitivity.unit_expo,
>>  				val1, val2);N�����r��y���b�X��ǧv�^�)޺{.n�+����{��*"��^n�r���z���h����&���G���h�(�階�ݢj"���m�����z�ޖ���f���h���~�mml==

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux