HID: provide a helper for validating hid reports
authorKees Cook <keescook@chromium.org>
Wed, 11 Sep 2013 19:56:50 +0000 (21:56 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 26 Oct 2013 20:06:04 +0000 (21:06 +0100)
commit9c8ea9f2d66ff437dd25da392a104947c703d975
tree80dae3abb25a3a09dfc7f53e0dc1e1b827a11af3
parenta9f6e2b7e9f392b07d6773a846511b8f1b6d3ef0
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>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/hid/hid-core.c
include/linux/hid.h