diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2019-01-09 06:50:18 +0300 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2019-01-10 09:08:18 +0300 |
commit | ee46967fc6e74d412fe1ec15f77fdb8624bde2b0 (patch) | |
tree | 586d3468d91b7059e2f8e9b200c95894501cd4a6 /include/linux/hid.h | |
parent | cf26057a9441173ad552e90cea3344607075c9ad (diff) | |
download | linux-ee46967fc6e74d412fe1ec15f77fdb8624bde2b0.tar.xz |
HID: core: replace the collection tree pointers with indices
Previously, the pointer to the parent collection was stored. If a device
exceeds 16 collections (HID_DEFAULT_NUM_COLLECTIONS), the array to store
the collections is reallocated, the pointer to the parent collection becomes
invalid.
Replace the pointers with an index-based lookup into the collections array.
Fixes: c53431eb696f3c ("HID: core: store the collections as a basic tree")
Reported-by: Pandruvada, Srinivas <srinivas.pandruvada@intel.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Kyle Pelton <kyle.d.pelton@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'include/linux/hid.h')
-rw-r--r-- | include/linux/hid.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/hid.h b/include/linux/hid.h index d99287327ef2..992bbb7196df 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -430,7 +430,7 @@ struct hid_local { */ struct hid_collection { - struct hid_collection *parent; + int parent_idx; /* device->collection */ unsigned type; unsigned usage; unsigned level; @@ -658,7 +658,7 @@ struct hid_parser { unsigned int *collection_stack; unsigned int collection_stack_ptr; unsigned int collection_stack_size; - struct hid_collection *active_collection; + int active_collection_idx; /* device->collection */ struct hid_device *device; unsigned int scan_flags; }; |