mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
1e87a2456b
commit
be67b68d52
|
@ -1169,7 +1169,12 @@ EXPORT_SYMBOL_GPL(hid_alloc_report_buf);
|
||||||
|
|
||||||
int hid_set_field(struct hid_field *field, unsigned offset, __s32 value)
|
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);
|
hid_dump_input(field->report->device, field->usage + offset, value);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue