Re: [PATCH] hid: hid-sensor-hub: clear memory to avoid random data

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

 



On Mon, 2016-11-07 at 01:04 +0000, Song Hongyan wrote:
> Initialize user buffer with 0s. This will avoid random data in the
> buffer,
> when the user buffer size is bigger than the actual report size.
> 
> Signed-off-by: Song Hongyan <hongyan.song@xxxxxxxxx>
> ---
>  drivers/hid/hid-sensor-hub.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-
> hub.c
> index 658a607..980992c 100644
> --- a/drivers/hid/hid-sensor-hub.c
> +++ b/drivers/hid/hid-sensor-hub.c
> @@ -212,6 +212,7 @@ int sensor_hub_set_feature(struct
> hid_sensor_hub_device *hsdev, u32 report_id,
>  	__s32 value;
>  	int ret = 0;
>  
I think you wanted this change in sensor_hub_get_feature
not sensor_hub_set_feature().

> +	memset(buffer, 0, buffer_size);
>  	mutex_lock(&data->mutex);
>  	report = sensor_hub_report(report_id, hsdev->hdev,
> HID_FEATURE_REPORT);
>  	if (!report || (field_index >= report->maxfield)) {��.n��������+%������w��{.n�����{��(��)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥




[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