Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2288041imw; Sun, 17 Jul 2022 05:46:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1seFh8Qq8b43VV0NQXcpEFeL0aXMDzHW5iJxrR4otQmSYYtu7YY1FtezeAwRWouuMAa8AmV X-Received: by 2002:a17:907:7d89:b0:72b:9eb4:a8c7 with SMTP id oz9-20020a1709077d8900b0072b9eb4a8c7mr20875543ejc.167.1658061972037; Sun, 17 Jul 2022 05:46:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658061972; cv=none; d=google.com; s=arc-20160816; b=Mt3Pw1qfjco3OCqiF8ZsDzJ7TjeMFwpcBTI3EVF67Z/PKrwX1bD28om1/hYNex8Dtm EFCyHeCT1Da8Y3e4dAlOBhNROrr21XFnTMqLSdmgZPsLPdvYlCIh57NbGSwiWtrZ/XSY IGg1BV5sRf3lbT1x2oYu4w3RKm+RdKHaHFRrhqU87bIOhilVofPa9ZFJtpgdaCMqu1ov 2JAGtz8yVL0Vji5EvvGNDNPJVi/zVEI+G9Ffzk2p8+5UezVsjTwkU5+jKDmZ7nYMK2kp IUuTJDM4WlHhH1mG49X/t2tL5ytlhhp90NV//r+LPqX6H295ZcXWJKF1LYFRvbC5sX7L xWsw== 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=eyGGShEtJ5QngHNH1K1pLBz5li6ed+QkJBaQv+XwZiI=; b=FIeVtvVv4MZ4eZbIO4Y0WGM++FPmyLd48HxQPiNGCgqFChOiVBsphRmqV91ZinDtCc Hzkw2RBYjQdqIoCzry7NVWvH0T/Xp0SXL7PgIyXV8P1vKhrM9cBnLm7xtxZs7D2R4xba 1XaNmYghjf7IGZydtNOXHT6pGJHGSjoDAw8gFwmjojM2CTswCXzBR2QNbbRL9x9wY0KT 0BtfCeKXSeYsY3fhlbwOonuCDBOGC5GoksMiBh1OgIUMdhgQwlz1XlDRhIo1tFrC3fZO 6LxuuHibQMLG9x1d1cVjR6VxPg+XRKaC9N7xKwvl9lvpxYVCbUv8PPd9hdzlmHsq+mdu KvTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PWIdhjos; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gr19-20020a170906e2d300b0072b48390b56si11332200ejb.755.2022.07.17.05.45.47; Sun, 17 Jul 2022 05:46:12 -0700 (PDT) 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=PWIdhjos; 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 S231911AbiGQMHv (ORCPT + 99 others); Sun, 17 Jul 2022 08:07:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbiGQMHt (ORCPT ); Sun, 17 Jul 2022 08:07:49 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 128D915813; Sun, 17 Jul 2022 05:07:45 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id l22-20020a05600c4f1600b003a2e10c8cdeso6337761wmq.1; Sun, 17 Jul 2022 05:07:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=eyGGShEtJ5QngHNH1K1pLBz5li6ed+QkJBaQv+XwZiI=; b=PWIdhjoscQZbm5ADgJnYohKqIsKWLtf9ju97xPrnOXe+r+K6GZUSF3tfsj/aCbTqrb F/LbLCCQTTCfifo/RD8KSt2dPqPFzcpyMPeS8ctW8SHsQQKsrU8IErMhKKxRMWgj/359 e6DjlWf1J82stxHU+kwgV7Exl/oOfeJL9vg9dWjL1t4qiC8HnmwcovSlVCPDyrGRNwzq OmznekccZqI7RrC5O/7ENb1H7RL4UyL2nS1Uqp4vcw38H7liMHVo8J0XFo804hctVutq hfesxY3bwOgYGyFEVNY02dN+nH0wrGJidrxkOkAQxUmq/Ixf2Mypvhz+iTPPLHGwc2v7 WQtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=eyGGShEtJ5QngHNH1K1pLBz5li6ed+QkJBaQv+XwZiI=; b=xKgCWtuHZB7JcFRJ2amlYTtoMQQMFz3PW2CEQhu49FAj80b3T1dMZBwkdFIU1C49Bf 44Sdjb0H2vE+GgD7UpEP+K3cw5L2tc0osCe2TNPIKeBnkBQ2kioh3wtqT/omXjkCy1mV /+CBnbRQhtBdFuQelBXgmQLIbnPWVwCFd3Si0rLkk4+HtVn+LUu/LGlwuAY6gEhml7Xt U90HwGvrBuRJW7WdsWrirWDW0QDt/v6K96SFoIGGqK+F82fe5pnaQIKwyJd1GEaRaW3s e1oFuK9KVYuKNSlGUQRKqJTPf2/iilaxfsdeUR5d3kIWv/yADO9Wle6fdbW3+qT8C2dL XG5w== X-Gm-Message-State: AJIora9P/rW7gi/O14KuEJWSzb5RNG/j79kY8ZN0LrsHq2WTfxouZwMV b/rPO8ACMNf/Z5s9J15O5z4= X-Received: by 2002:a7b:c381:0:b0:3a2:fe96:2ce4 with SMTP id s1-20020a7bc381000000b003a2fe962ce4mr19633955wmj.70.1658059663508; Sun, 17 Jul 2022 05:07:43 -0700 (PDT) Received: from xws.localdomain (pd9ea330d.dip0.t-ipconnect.de. [217.234.51.13]) by smtp.gmail.com with ESMTPSA id f7-20020a05600c154700b003a2fcc32031sm16584324wmg.3.2022.07.17.05.07.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jul 2022 05:07:43 -0700 (PDT) From: Maximilian Luz To: Hans de Goede Cc: Mark Gross , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Maximilian Luz , kernel test robot Subject: [PATCH] platform/surface: tabletsw: Fix __le32 integer access Date: Sun, 17 Jul 2022 14:07:35 +0200 Message-Id: <20220717120735.2052160-1-luzmaximilian@gmail.com> X-Mailer: git-send-email 2.37.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: X-Mailing-List: linux-kernel@vger.kernel.org The sources.count field is a __le32 inside a packed struct. So use the proper functions to access it. Reported-by: kernel test robot Fixes: 9f794056db5b ("platform/surface: Add KIP/POS tablet-mode switch driver") Signed-off-by: Maximilian Luz --- drivers/platform/surface/surface_aggregator_tabletsw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/platform/surface/surface_aggregator_tabletsw.c b/drivers/platform/surface/surface_aggregator_tabletsw.c index 596ca6c80681..27d95a6a7851 100644 --- a/drivers/platform/surface/surface_aggregator_tabletsw.c +++ b/drivers/platform/surface/surface_aggregator_tabletsw.c @@ -410,7 +410,7 @@ static int ssam_pos_get_source(struct ssam_tablet_sw *sw, u32 *source_id) if (status) return status; - if (sources.count == 0) { + if (get_unaligned_le32(&sources.count) == 0) { dev_err(&sw->sdev->dev, "no posture sources found\n"); return -ENODEV; } @@ -422,7 +422,7 @@ static int ssam_pos_get_source(struct ssam_tablet_sw *sw, u32 *source_id) * is a device that provides multiple sources, at which point we can * then try to figure out how to handle them. */ - WARN_ON(sources.count > 1); + WARN_ON(get_unaligned_le32(&sources.count) > 1); *source_id = get_unaligned_le32(&sources.id[0]); return 0; -- 2.37.0