Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4dd1769a authored by Will McVicker's avatar Will McVicker Committed by laxman
Browse files

[CVE-2021-0512] HID: make arrays usage and value to be the same



Change-Id: Ib0890399c460a92c04555883d8f0d3f84f3b3718
Cc: stable@vger.kernel.org
Signed-off-by: default avatarWill McVicker <willmcvicker@google.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry-pick from 81a46cff782183756c60bda4e165d97fcd05bde6)

Change-Id: I7c9c9943b7c013861df98880f91d66ac5eb85be2
parent 699d14e5
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ EXPORT_SYMBOL_GPL(hid_register_report);
 * Register a new field for this report.
 */

static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages, unsigned values)
static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages)
{
	struct hid_field *field;

@@ -104,7 +104,7 @@ static struct hid_field *hid_register_field(struct hid_report *report, unsigned

	field = kzalloc((sizeof(struct hid_field) +
			 usages * sizeof(struct hid_usage) +
			 values * sizeof(unsigned)), GFP_KERNEL);
			 usages * sizeof(unsigned)), GFP_KERNEL);
	if (!field)
		return NULL;

@@ -300,7 +300,7 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
	usages = max_t(unsigned, parser->local.usage_index,
				 parser->global.report_count);

	field = hid_register_field(report, usages, parser->global.report_count);
	field = hid_register_field(report, usages);
	if (!field)
		return 0;