HID: uclogic: Add NULL check in uclogic_input_configured()
[ Upstream commitbd07f75120] devm_kasprintf() returns NULL when memory allocation fails. Currently, uclogic_input_configured() does not check for this case, which results in a NULL pointer dereference. Add NULL check after devm_kasprintf() to prevent this issue. Fixes:dd613a4e45("HID: uclogic: Correct devm device reference for hidinput input_dev name") Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
4715f16b1e
commit
ad6caaf29b
@@ -142,11 +142,12 @@ static int uclogic_input_configured(struct hid_device *hdev,
|
||||
suffix = "System Control";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (suffix)
|
||||
} else {
|
||||
hi->input->name = devm_kasprintf(&hdev->dev, GFP_KERNEL,
|
||||
"%s %s", hdev->name, suffix);
|
||||
if (!hi->input->name)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user