X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=drivers%2Fhid%2Fhid-sensor-hub.c;h=aa34755ca205eb6955cb10b01b2a6b01bc1a3dd1;hb=2606d2448703e8995ca39a59d8a1106a1e0f034a;hp=ca74981073271effdddc72ba1f173acea27ebbf9;hpb=aad760136537fdfa10e5ac76bd3c79bde2100863;p=firefly-linux-kernel-4.4.55.git diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index ca7498107327..aa34755ca205 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c @@ -221,7 +221,8 @@ int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, mutex_lock(&data->mutex); report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); - if (!report || (field_index >= report->maxfield)) { + if (!report || (field_index >= report->maxfield) || + report->field[field_index]->report_count < 1) { ret = -EINVAL; goto done_proc; }