linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hid: hid-sensor-hub: clear memory to avoid random data
@ 2016-11-07  1:04 Song Hongyan
  2016-11-07 17:17 ` Pandruvada, Srinivas
  0 siblings, 1 reply; 4+ messages in thread
From: Song Hongyan @ 2016-11-07  1:04 UTC (permalink / raw)
  To: linux-iio; +Cc: srinivas.pandruvada, Song Hongyan

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@intel.com>
---
 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;
 
+	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)) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH] hid: hid-sensor-hub: clear memory to avoid random data
@ 2016-11-08  0:55 Song Hongyan
  2016-11-08 16:50 ` Pandruvada, Srinivas
  0 siblings, 1 reply; 4+ messages in thread
From: Song Hongyan @ 2016-11-08  0:55 UTC (permalink / raw)
  To: linux-iio; +Cc: srinivas.pandruvada, Song Hongyan

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@intel.com>
---
 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..b74d954 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -252,6 +252,7 @@ int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
 	int report_size;
 	int ret = 0;
 
+	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) ||
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-11-08 16:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-07  1:04 [PATCH] hid: hid-sensor-hub: clear memory to avoid random data Song Hongyan
2016-11-07 17:17 ` Pandruvada, Srinivas
  -- strict thread matches above, loose matches on Subject: below --
2016-11-08  0:55 Song Hongyan
2016-11-08 16:50 ` Pandruvada, Srinivas

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).