Message ID | 20221110174918.398567-1-jose.exposito89@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp286254wru; Thu, 10 Nov 2022 09:52:22 -0800 (PST) X-Google-Smtp-Source: AMsMyM7wbJKY9PZ3rvTvOvu6SU0Zjv87VuFoags0EOa8sVB2JhqH2L1pb4xr3TKfGXM0522DWgHv X-Received: by 2002:a17:902:f80b:b0:178:2eca:9e1d with SMTP id ix11-20020a170902f80b00b001782eca9e1dmr1646870plb.43.1668102742083; Thu, 10 Nov 2022 09:52:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668102742; cv=none; d=google.com; s=arc-20160816; b=UniBjJz1pxLzNhKWMrResDk5xiDxar2NS697ZdGDSA9tmn9csZjE6Vv1zyUQFklZSZ 7DHRzQwJ73Nivov0YHa4BDVwZV3GGBDjIYDB1AjQb6KhYsxS2qnyPcFqUGdPo2QquCg7 PqM0fcsLT/kwwAHmRPe75Uq2pQV6xna8Q9X20N9BfxumbMwqUvQVlLBEUMAuuHitjNkk GfhwgJmYeb2/XxqM0P7ZPTDV/iBDtXH9ZwRNHFKeMGWNcv4LNzzVBSdclTNBxc6pdUcK cL66LV5ysCmpHMtjvOPtJc9k2CadlBAw1ZXSSUf04RM3u4iW2CfeL5mKSiJIpXausafS quow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=thGe8bZx3s7qyOvNmBFIp26dCpE+t2vRJmjbPbSwWv0=; b=Q5My9zoMXpwOE8WcYmwNscvMpgz3q29auze+0gv2ZjIemGuG1u8Mok25ghw8coti92 DQss7ujj7fFEbj/q5lx2o5Nv2WkdqFqLMlWxBWllGSw2YTJEB9on8Zw9bix0dJ84omPY +LWeMAZNlfV3T2MLey6b0Ly4MB7spsQH8RP8r5Fyb0jVeeSwQvk1lzPwRMtGkpfusEeU /8gzaoP4wBMg3LRUU6cJkVBug75DVAOSArh5NQ7BHvTgXbLl0ZgYDSqPoAWKfDaGlKga 7f8ObAaDNj6yBkdbjj2Rwn1pVOt3D+xeJbnh5xs+gsohuoj6dFiYqFlFYZbBBpmyk4EB 2bLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ONWFwgQt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m76-20020a633f4f000000b0046edec119f6si20691827pga.227.2022.11.10.09.52.07; Thu, 10 Nov 2022 09:52:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ONWFwgQt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229461AbiKJRtb (ORCPT <rfc822;winker.wchi@gmail.com> + 99 others); Thu, 10 Nov 2022 12:49:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231268AbiKJRt0 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 10 Nov 2022 12:49:26 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F06E2303D1; Thu, 10 Nov 2022 09:49:22 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id z14so3352984wrn.7; Thu, 10 Nov 2022 09:49:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=thGe8bZx3s7qyOvNmBFIp26dCpE+t2vRJmjbPbSwWv0=; b=ONWFwgQtbmGHXBn7m4CDmFUN8u4iYggFrjuIAlbFOjpj9pX4+79TmwMN2eKg8UdiCK ZXlfmQgGh0kEVLd7LkfPivlGNcY+JMflMpXi76UbNuyyXOKbBjAWQWa79psuAnkZZM2r bJ4lDirw7RSEe8J6otLMxkYPdadH/P2Vf/59UGVOOwBuL2b914/n9bSeSkl/lxggFlYO N9ktFPDAqFXnEsGPSNUfDQfU2mONd9JSnBG0/Yfd3jSWSMRZRESpbwALySPnYjOqRL9X BEfnlrIWJx0RJePuWL+k8SOtJGvQQcNnqojPV0oAlLrgkzbKn6sIa4zKZzIrHYAeGOSd mnww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=thGe8bZx3s7qyOvNmBFIp26dCpE+t2vRJmjbPbSwWv0=; b=QsfP1lbCp/M2mczOry+b826vyyG+AsEjDuPm2pDGIWjgNIHfvHiQuvKZyz5LyGG5Su sctNLrGBHd+RQ/82gPIW17rqBZsLe4tRVQYUUt5UvZ7C1FL9Vx65lr2I1rEDxlMU3P5j 2ttqbHj3Bj2BDW0OkpRpiXgUP2JXMhdrnN1LVZ8uybBhhnFW1XlP+Qjj8xOvYzTkFXdv 9IaokHUyeKjRIPrEAi6+ikkMF/acWYVHv/8F/jxUsBqkDowPYCsEFae8aiKzbzCmSI8W lvMpv8MwfdD+KmLWN6zIdVntebt471XrfpQ94XNhYxX8b/+j1vrd9gTcuquD+jVzv1mJ 57WA== X-Gm-Message-State: ACrzQf04e4ZoXsMIx4aauY1X1dhswe25x9aCsZPBY20CpR3sz3L1vWkn RH0U09EUCjXmafCBubwkahU= X-Received: by 2002:adf:f78f:0:b0:236:992b:1f62 with SMTP id q15-20020adff78f000000b00236992b1f62mr40767234wrp.605.1668102561570; Thu, 10 Nov 2022 09:49:21 -0800 (PST) Received: from localhost.localdomain ([94.73.35.109]) by smtp.gmail.com with ESMTPSA id z9-20020a5d6409000000b00228d67db06esm16438611wru.21.2022.11.10.09.49.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 09:49:21 -0800 (PST) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= <jose.exposito89@gmail.com> To: jikos@kernel.org Cc: benjamin.tissoires@redhat.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= <jose.exposito89@gmail.com> Subject: [PATCH] HID: uclogic: Fix frame templates for big endian architectures Date: Thu, 10 Nov 2022 18:49:18 +0100 Message-Id: <20221110174918.398567-1-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749132500848094821?= X-GMAIL-MSGID: =?utf-8?q?1749132500848094821?= |
Series |
HID: uclogic: Fix frame templates for big endian architectures
|
|
Commit Message
José Expósito
Nov. 10, 2022, 5:49 p.m. UTC
When parsing a frame template with a placeholder indicating the number
of buttons present on the frame its value was incorrectly set on big
endian architectures due to double little endian conversion.
In order to reproduce the issue and verify the fix, run the HID KUnit
tests on the PowerPC architecture:
$ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/hid \
--arch=powerpc --cross_compile=powerpc64-linux-gnu-
Fixes: 867c89254425 ("HID: uclogic: Allow to generate frame templates")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
drivers/hid/hid-uclogic-rdesc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Thu, 10 Nov 2022, José Expósito wrote: > When parsing a frame template with a placeholder indicating the number > of buttons present on the frame its value was incorrectly set on big > endian architectures due to double little endian conversion. > > In order to reproduce the issue and verify the fix, run the HID KUnit > tests on the PowerPC architecture: > > $ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/hid \ > --arch=powerpc --cross_compile=powerpc64-linux-gnu- > > Fixes: 867c89254425 ("HID: uclogic: Allow to generate frame templates") > Signed-off-by: José Expósito <jose.exposito89@gmail.com> > --- > drivers/hid/hid-uclogic-rdesc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/hid/hid-uclogic-rdesc.c b/drivers/hid/hid-uclogic-rdesc.c > index 4bd54c4fb5b0..6b73eb0df6bd 100644 > --- a/drivers/hid/hid-uclogic-rdesc.c > +++ b/drivers/hid/hid-uclogic-rdesc.c > @@ -1193,7 +1193,7 @@ __u8 *uclogic_rdesc_template_apply(const __u8 *template_ptr, > p[sizeof(btn_head)] < param_num) { > v = param_list[p[sizeof(btn_head)]]; > put_unaligned((__u8)0x2A, p); /* Usage Maximum */ > - put_unaligned_le16((__force u16)cpu_to_le16(v), p + 1); > + put_unaligned((__force u16)cpu_to_le16(v), (s16 *)(p + 1)); > p += sizeof(btn_head) + 1; > } else { Applied to hid.git#for-6.1/upstream-fixes, thanks José.
diff --git a/drivers/hid/hid-uclogic-rdesc.c b/drivers/hid/hid-uclogic-rdesc.c index 4bd54c4fb5b0..6b73eb0df6bd 100644 --- a/drivers/hid/hid-uclogic-rdesc.c +++ b/drivers/hid/hid-uclogic-rdesc.c @@ -1193,7 +1193,7 @@ __u8 *uclogic_rdesc_template_apply(const __u8 *template_ptr, p[sizeof(btn_head)] < param_num) { v = param_list[p[sizeof(btn_head)]]; put_unaligned((__u8)0x2A, p); /* Usage Maximum */ - put_unaligned_le16((__force u16)cpu_to_le16(v), p + 1); + put_unaligned((__force u16)cpu_to_le16(v), (s16 *)(p + 1)); p += sizeof(btn_head) + 1; } else { p++;