mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maximilian Luz <luzmaximilian@gmail.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Mark Gross <markgross@kernel.org>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Maximilian Luz <luzmaximilian@gmail.com>,
	kernel test robot <lkp@intel.com>
Subject: [PATCH] platform/surface: tabletsw: Fix __le32 integer access
Date: Sun, 17 Jul 2022 14:07:35 +0200	[thread overview]
Message-ID: <20220717120735.2052160-1-luzmaximilian@gmail.com> (raw)

The sources.count field is a __le32 inside a packed struct. So use the
proper functions to access it.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: 9f794056db5b ("platform/surface: Add KIP/POS tablet-mode switch driver")
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
---
 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


             reply	other threads:[~2022-07-17 12:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-17 12:07 Maximilian Luz [this message]
2022-07-17 14:50 ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220717120735.2052160-1-luzmaximilian@gmail.com \
    --to=luzmaximilian@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®