diff options
author | Kees Cook <keescook@chromium.org> | 2013-08-29 00:32:01 +0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2013-09-04 14:05:31 +0400 |
commit | be67b68d52fa28b9b721c47bb42068f0c1214855 (patch) | |
tree | 8be7d0b0194e6c7c138c55dccdefaf406dd6e46c /drivers/hid | |
parent | 1e87a2456b0227ca4ab881e19a11bb99d164e792 (diff) | |
download | linux-be67b68d52fa28b9b721c47bb42068f0c1214855.tar.xz |
HID: check for NULL field when setting values
Defensively check that the field to be worked on is not NULL.
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: stable@kernel.org
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-core.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index ebf57813d31a..dcd60eb3d5ea 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1169,7 +1169,12 @@ EXPORT_SYMBOL_GPL(hid_alloc_report_buf); int hid_set_field(struct hid_field *field, unsigned offset, __s32 value) { - unsigned size = field->report_size; + unsigned size; + + if (!field) + return -1; + + size = field->report_size; hid_dump_input(field->report->device, field->usage + offset, value); |