diff options
author | Kees Cook <keescook@chromium.org> | 2013-08-28 16:32:01 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2013-09-04 06:05:31 -0400 |
commit | be67b68d52fa28b9b721c47bb42068f0c1214855 (patch) | |
tree | 8be7d0b0194e6c7c138c55dccdefaf406dd6e46c /drivers/hid | |
parent | 1e87a2456b0227ca4ab881e19a11bb99d164e792 (diff) |
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); | |||
1169 | 1169 | ||
1170 | int hid_set_field(struct hid_field *field, unsigned offset, __s32 value) | 1170 | int hid_set_field(struct hid_field *field, unsigned offset, __s32 value) |
1171 | { | 1171 | { |
1172 | unsigned size = field->report_size; | 1172 | unsigned size; |
1173 | |||
1174 | if (!field) | ||
1175 | return -1; | ||
1176 | |||
1177 | size = field->report_size; | ||
1173 | 1178 | ||
1174 | hid_dump_input(field->report->device, field->usage + offset, value); | 1179 | hid_dump_input(field->report->device, field->usage + offset, value); |
1175 | 1180 | ||