Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2300711iof; Wed, 8 Jun 2022 01:53:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2Xmwav0/KjwsjNDdKHSiuw1kcGXd4wh8GCu+j1Sqq+tXPx5TznjiATm9ZIW4QBiFgEeay X-Received: by 2002:a65:52cd:0:b0:3f5:f3fb:6780 with SMTP id z13-20020a6552cd000000b003f5f3fb6780mr29694587pgp.150.1654678399699; Wed, 08 Jun 2022 01:53:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1654678399; cv=pass; d=google.com; s=arc-20160816; b=AL4YwbCSRplIv8orTGP+oYVZzNGT2KUED4btFHTz2u59i/0kY3EAoHF3QxaoMWcl2G 2WUIJYLrGGdND8KSJdzUy+BS7oDbkskDnl+JNVMG5wEXphn8dvYisdL+aScHQRq32sfx TYwZVU4XbHAFLL18txfF8Qdcy7/DES0f3+c2pDh0yx1NFcMCehMQ5/NNLziAQYWa24xw ceEfT9zxSzjk9lq3vwGDOPx1kebrTgwS4LvKEAxQl8hKzpXwafU4TeAnUdCNc6tpFGWp HuHRtsrKLtRic7Bz+BPUhaNwI/qiB22gRvE0IHd1DUE5mVOseUc6usO4TOiaerHtVZHZ 0Abw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=UQCEWsBoEhimCAQcWrgDX92W8vb2QCc3ZdPSMPj2VnI=; b=A/kr//6jLLm8BBbMSiqEOSPL5OdYaje3D36e8/oNby6wwKfTzJd1dKyv6LWCOzsp61 ytTaZyAXA5lTV8N44RiSbw360BiEEnocvGmAiokM1yo/ff99h+EH5S6pcN286loaEPE2 2MCZg+IkL175LdnsvjdclFY5QLYh2+hcvzgpCJtHeS7kplwiWU8Hug3mzgsoTMLWhWnQ o6KTGhO6lKFi92igqEWoyM2efbzY2j4bzqxOhl9V8O8a2NTozYOsJg66VFos0VX5/mIg pb2glJM9PWfGp4hj9XKuF8iEJHIwtMC41wPQGfMzu1dsbSoYyh96liy8x8XNnmgUl0z7 HvqQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=gamrpBT2; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d19-20020a056a0010d300b0051c3c622daasi5763478pfu.160.2022.06.08.01.53.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 01:53:19 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=gamrpBT2; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EFE8F3C503A; Wed, 8 Jun 2022 01:16:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238800AbiFHGFY (ORCPT + 99 others); Wed, 8 Jun 2022 02:05:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243050AbiFHFyL (ORCPT ); Wed, 8 Jun 2022 01:54:11 -0400 Received: from na01-obe.outbound.protection.outlook.com (mail-bgr052101064021.outbound.protection.outlook.com [52.101.64.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE3DB392A1F; Tue, 7 Jun 2022 20:50:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dzv/EZhxviljfn/wqhoi8O/JeduCKe2Mr4lF7ZqcyFTrWzSNwwZ0TRGhEkk3looOvJFkAkMvbvcmp+IZlAIvZkVhNwd70iufyF5CDkOINckYo8yyhlxvGYL2hl4FuBTl9WFgnxmRvNJ2lfliMkMY5Zf0DTHMW7XqV+wRUXmx9b7HPdB7k8y8kLk9BRtIgZXV80OqSi7c3mkOk1JPREMFpX+StbVbZRpi0KYt2RYxXb9KgrnCT8l1+bsqA9ALDad27Qavv3U4M1eAnhHyLjEf2Fqi+3K/8pUdohtDomr+iQqG81ZbHn09gpt9SqKKsg/eE11JFOU3FabNLVYH4kNcWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UQCEWsBoEhimCAQcWrgDX92W8vb2QCc3ZdPSMPj2VnI=; b=KLa3Q0Qxci73I25KT/6+wEQhAsSQbZf9p2eOsIBmTezGYMbA+IFCG4kLV86UgNsYPZktiUCU8IoDr9gLD3wQJtRP1rbGEOFtopIgEgwFClxqja1TO2wvLZ+q0RrqaqfKyvuIPZQFrQfnPb7c2wnATcLrn4BQ3DKQX53qUTB8k/e1EI9v3NKFFg9CCoqbspXgqSvc+yZIAR2tKzh/S8KtVZhQxQvb4utXarq1LK39dDSulyaJ5YsTEDCIHgVeAarnR5NuSgwwV1OFHQjn4gTCDuq9tFHjDF60KcW2CaEqjUej49N7bONCx1kvKsYR/XC1oEwmpGJIfGgSXBirabHpxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UQCEWsBoEhimCAQcWrgDX92W8vb2QCc3ZdPSMPj2VnI=; b=gamrpBT2vvP10dhWoutOJJQrHMFbyY3cilfEnlRb4trT3c/DjsB0QQyrE4Ua8ulQrxeT7VgpUN9pc0rWd3jgSXLk+HrDzjMF3/zfXLPSdHX0R3B/qpKyZnbHJNURwhSjqC+lVEtJwFdjZFG+RtRSweAnqpCCcax0rrEDNBSLhAk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; Received: from DM6PR21MB1370.namprd21.prod.outlook.com (2603:10b6:5:16b::28) by CO1PR21MB1299.namprd21.prod.outlook.com (2603:10b6:303:162::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.4; Wed, 8 Jun 2022 03:50:21 +0000 Received: from DM6PR21MB1370.namprd21.prod.outlook.com ([fe80::810e:942d:9455:26f8]) by DM6PR21MB1370.namprd21.prod.outlook.com ([fe80::810e:942d:9455:26f8%8]) with mapi id 15.20.5353.001; Wed, 8 Jun 2022 03:50:21 +0000 From: Michael Kelley To: sthemmin@microsoft.com, kys@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, haiyangz@microsoft.com, jikos@kernel.org, benjamin.tissoires@redhat.com, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-input@vger.kernel.org Cc: mikelley@microsoft.com Subject: [PATCH 1/1] HID: hyperv: Correctly access fields declared as __le16 Date: Tue, 7 Jun 2022 20:49:37 -0700 Message-Id: <1654660177-115463-1-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 Content-Type: text/plain X-ClientProxiedBy: MW4PR04CA0281.namprd04.prod.outlook.com (2603:10b6:303:89::16) To DM6PR21MB1370.namprd21.prod.outlook.com (2603:10b6:5:16b::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d86e8abd-1c82-4ff0-d19d-08da490202db X-MS-TrafficTypeDiagnostic: CO1PR21MB1299:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VR2DYxxdQYv5QnNGyd/ZNxNyNq5PCOH3PBulOfuwNPNnYuYI22xmJrLretmFSG0hb7Y3kKRp/xT7dPSjuZ0Ht9siUl3nq0GtUlMrnCN7zjeYKGEYz14p3GVrkk118c31du2+gmAOpu5LG0Ndi+8SlkI2733umt4EIhQJfWC9lilqAaFMyaKoNjXv/E0Q4m50wPixIDWhkFcXZD1EXNu7HQn/pxCu7Z9tTkPbqWbyOtENX3cmgW9eDwhukeKArqu9Idngza6OYGAKYBk/0Ic1Qr++S8vz+jF+y1Qaj6VWbkKbjqVUxEAKubT6JIv7qdRx0kxGzfUaAQM1HotVGSjWDwngimKuae8VZ6HilJB+SrR/eIat4UUKaFP+YKEsFG7K1G24uO2fRT/frFlSyDw8bsvffy195+7eSCvAo+ANvixiMIMQQWYMilKl54u3s5uytwYDznoX8CDZKqHAJqP1W7NSi4YCDkzTc9UogjXDWjGUoM3lgmEUIqADd6Hg9zE7qudwJz+sNlXgrXfosklX5fe12N7uAimAl5QOFLI9ECOrEof0/so+UzCrk1+S2IgRkRDYKgSqMHqsoZPYbKc6VkciT30yGXccQo3TR/9iMT9yk4ObcEFQ4LbEwj4c9codRgi1koSutiEKchHmwxJbBJxKrZgYYGbHoI9NGSbYvpmt1ZQLT+rZaGzm+sl6asb1t9VSAG63osWaVgCBWAl/hGVh99Tpu9JPSgGGjNm4lXrrmXxv8spYd7LDMDJJfjkrgD0ruEN0LVd+bzmfbE7XWA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR21MB1370.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(451199009)(508600001)(5660300002)(6486002)(86362001)(8936002)(186003)(6512007)(26005)(6506007)(2616005)(107886003)(2906002)(52116002)(6666004)(4326008)(8676002)(66946007)(66556008)(82960400001)(316002)(38100700002)(66476007)(38350700002)(921005)(10290500003)(36756003)(82950400001)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?5o9rNyKZOrV809lvsjEdrp9DWp2ybjy8d1sqftCML/Fi9dXgrorwVO5ITP/U?= =?us-ascii?Q?Rmm4+erk7XNXzqlwqBszELtKdBU10TWrPkEgFmwsFnQ+mBgeLYjeNrfHZ6y4?= =?us-ascii?Q?xa+HOo5yYSmoaG8WrBJa8MGMYAncQ27CpRjDnUa2LTd1LZtpjzMk4qAhDhkf?= =?us-ascii?Q?n0HfkgJN8JwoGzMnhVw/GqSLSCbJoPUCgDiLpm7waH0CxtLVg2ZWtUZaH9tR?= =?us-ascii?Q?3QKGW7kDG60dHcqgICmM0FlBcAzB4BzR4grlkX3acVIpYH1bZLpTP1CZ8H66?= =?us-ascii?Q?bvwfTp63HK247EdOgWD6NPCW9lrGfp8KcdJctZLJEQEEA7tWf6bSH/6JumuE?= =?us-ascii?Q?pfr/8PWh1wwyzID9caFq5v7PmppAKIM9fBvWQYmgJXdF8kV72DRBGilBdK1Y?= =?us-ascii?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GOPoTNEdUySjBjh3ReFJCcWZ2Oqr?= =?us-ascii?Q?pdmy5YpCvq32+k/eJk4Ez979D8eT3Utr3UhcnL1qBI3i90pXBxrRsBT9XzfR?= =?us-ascii?Q?kSvdCOWkverw40KteUqek1kjG0G298LALU5I9LLlGJdXPbKFMvrT4IAW5I1/?= =?us-ascii?Q?R3yFITP0I+OqvC129r+RyuP2cNdUejj/kugk90vEPKxY2qMwha+8al5DFQfk?= =?us-ascii?Q?mfKB237UKrP61kEa2/2kLbonjbo/dt8x+IZu7a6aNLcBeoI1wXjXMYG+MEJS?= =?us-ascii?Q?NmU/SuCQtOSrDmiBqt6IitNi8dOCOUa2JZIFSd4qjINFmToUj6K/dBG2wPDH?= =?us-ascii?Q?GAl3k5HBbZv4CFnj+4bcDVLTa74Qv2mGZ/3dccydXsyXMtDE8hyWWgkyirO0?= =?us-ascii?Q?DZ9oMBW35YZV+bjzX0huIsNeWLvG4s5oe2TBDzmEor9Dlqkau/y3Ah9C3X/0?= =?us-ascii?Q?TnPguWC3amS6b64mT03Se+T2qOX79kw=3D?= X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: d86e8abd-1c82-4ff0-d19d-08da490202db X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1370.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2022 03:50:21.4631 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZtiOkZbACHz1pTtx9iZPSTJktIY9sQbEk+Xus0siniG7D5vDttJ8Aw4qoRXYO4a/hfSRrOT4expfO2A8/gVBIA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR21MB1299 X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org Add the use of le16_to_cpu() for fields declared as __le16. Because Hyper-V only runs in Little Endian mode, there's no actual bug. The change is made in the interest of general correctness in addition to making sparse happy. No functional change. Reported-by: kernel test robot Signed-off-by: Michael Kelley --- drivers/hid/hid-hyperv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c index 978ee2a..e0bc731 100644 --- a/drivers/hid/hid-hyperv.c +++ b/drivers/hid/hid-hyperv.c @@ -199,7 +199,8 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device, if (!input_device->hid_desc) goto cleanup; - input_device->report_desc_size = desc->desc[0].wDescriptorLength; + input_device->report_desc_size = le16_to_cpu( + desc->desc[0].wDescriptorLength); if (input_device->report_desc_size == 0) { input_device->dev_info_status = -EINVAL; goto cleanup; @@ -217,7 +218,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device, memcpy(input_device->report_desc, ((unsigned char *)desc) + desc->bLength, - desc->desc[0].wDescriptorLength); + le16_to_cpu(desc->desc[0].wDescriptorLength)); /* Send the ack */ memset(&ack, 0, sizeof(struct mousevsc_prt_msg)); -- 1.8.3.1