Re: [PATCH v2] HID: core: check whether usage page item is after usage id item

From: Nicolas Saenz Julienne
Date: Thu Oct 10 2019 - 03:42:51 EST


On Thu, 2019-10-10 at 11:05 +0800, Candle Sun wrote:
> > > -static void hid_concatenate_usage_page(struct hid_parser *parser)
> > > +static void hid_concatenate_last_usage_page(struct hid_parser *parser)
> > > {
> > > int i;
> > > + unsigned int usage;
> > > + unsigned int usage_page = parser->global.usage_page;
> > > +
> > > + if (!parser->local.usage_page_last)
> > > + return;
> > >
> > > for (i = 0; i < parser->local.usage_index; i++)
> >
> > Technically correct but it's preferred if you use braces here.
> >
>
> Nicolas, do you mean this:
>
> @@ -563,12 +563,13 @@ static void
> hid_concatenate_last_usage_page(struct hid_parser *parser)
> if (!parser->local.usage_page_last)
> return;
>
> - for (i = 0; i < parser->local.usage_index; i++)
> + for (i = 0; i < parser->local.usage_index; i++) {
> if (parser->local.usage_size[i] <= 2) {
> usage = parser->local.usage[i];
> parser->local.usage[i] =
> GET_COMPLETE_USAGE(usage_page, usage);
> }
> + }
> }

Yes, thanks!

Regards,
Nicolas

Attachment: signature.asc
Description: This is a digitally signed message part