From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Munteanu Subject: Re: [PATCH 2/2] HID: redragon Add additional verification to rdesc modification quirk Date: Fri, 03 Aug 2018 16:21:56 +0300 Message-ID: <393a529f40e7d61493178a1baeee5e2679c7da11.camel@apache.org> References: <1532807605-26023-1-git-send-email-JohnSGruber@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: John S Gruber , Jiri Kosina , linux-input@vger.kernel.org, benjamin.tissoires@redhat.com, dmitry.torokhov@gmail.com, linux-kernel@vger.kernel.org List-Id: linux-input@vger.kernel.org On Sat, 2018-07-28 at 15:53 -0400, John S Gruber wrote: > There are many devices using the vendor_id 0c45 and device_id of 760b > combination. Also the two bytes 0x81 0x00 aren't rare for a report > description. For these reasons the report description being altered > by the quirk should be verified more completely > > If I'm understanding this correctly, I believe for an array field the > report_size should be greater or equal to > ceil(log2(usage_maximum - usage_minimum + 1)). That's 3 bits for > these 8 > shift keys, 0xe0-0xe7. Therefore the incorrect report description > can't > be valid for any device. > > Check the actual count of the rdesc and compare the entire field > description to reduce the chance of patching the wrong thing by > inadvertence. > > Signed-off-by: John S Gruber I tested this on 4.17.11 with 85455dd906d5 and cbe7e3ad0eab from Jiri's for-4.19/upstream tree and it works just fine. Feel free to add Acked-By: Robert Munteanu Thanks for looking into this. Robert