diff options
author | Kees Cook <keescook@chromium.org> | 2013-09-11 15:56:50 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-10-01 12:17:46 -0400 |
commit | 791abfbee86161ad63bddc6af88c0391ef7332bd (patch) | |
tree | 679ce9239aaed23b5cc57c7ee471d95fabb91668 /include | |
parent | 51f5294797f14185f9b25ad0972a4abbbeff70c6 (diff) |
HID: provide a helper for validating hid reports
commit 331415ff16a12147d57d5c953f3a961b7ede348b upstream.
Many drivers need to validate the characteristics of their HID report
during initialization to avoid misusing the reports. This adds a common
helper to perform validation of the report exisitng, the field existing,
and the expected number of values within the field.
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/hid.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/hid.h b/include/linux/hid.h index ff545cc33c3a..6e185509046d 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -749,6 +749,10 @@ void hid_output_report(struct hid_report *report, __u8 *data); | |||
749 | struct hid_device *hid_allocate_device(void); | 749 | struct hid_device *hid_allocate_device(void); |
750 | struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); | 750 | struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); |
751 | int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); | 751 | int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); |
752 | struct hid_report *hid_validate_values(struct hid_device *hid, | ||
753 | unsigned int type, unsigned int id, | ||
754 | unsigned int field_index, | ||
755 | unsigned int report_counts); | ||
752 | int hid_open_report(struct hid_device *device); | 756 | int hid_open_report(struct hid_device *device); |
753 | int hid_check_keys_pressed(struct hid_device *hid); | 757 | int hid_check_keys_pressed(struct hid_device *hid); |
754 | int hid_connect(struct hid_device *hid, unsigned int connect_mask); | 758 | int hid_connect(struct hid_device *hid, unsigned int connect_mask); |