From: Guenter Roeck <linux@roeck-us.net>
To: Tzung-Bi Shih <tzungbi@kernel.org>
Cc: chrome-platform@lists.linux.dev, linux-hwmon@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Benson Leung" <bleung@chromium.org>,
"Guenter Roeck" <linux@roeck-us.net>,
"Thomas Weißschuh" <linux@weissschuh.net>
Subject: [PATCH] hwmon: (cros-ec_hwmon) Fix access to restricted __le16
Date: Thu, 6 Jun 2024 11:05:07 -0700 [thread overview]
Message-ID: <20240606180507.3332237-1-linux@roeck-us.net> (raw)
0-day complains:
drivers-hwmon-cros_ec_hwmon.c:sparse:sparse:cast-to-restricted-__le16
Fix by using a __le16 typed variable as parameter to le16_to_cpu().
Fixes: bc3e45258096 ("hwmon: add ChromeOS EC driver")
Cc: Thomas Weißschuh <linux@weissschuh.net>
Cc: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/hwmon/cros_ec_hwmon.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/cros_ec_hwmon.c b/drivers/hwmon/cros_ec_hwmon.c
index 41f268fa8260..f586987c3502 100644
--- a/drivers/hwmon/cros_ec_hwmon.c
+++ b/drivers/hwmon/cros_ec_hwmon.c
@@ -26,12 +26,13 @@ struct cros_ec_hwmon_priv {
static int cros_ec_hwmon_read_fan_speed(struct cros_ec_device *cros_ec, u8 index, u16 *speed)
{
int ret;
+ __le16 __speed;
- ret = cros_ec_cmd_readmem(cros_ec, EC_MEMMAP_FAN + index * 2, 2, speed);
+ ret = cros_ec_cmd_readmem(cros_ec, EC_MEMMAP_FAN + index * 2, 2, &__speed);
if (ret < 0)
return ret;
- *speed = le16_to_cpu(*speed);
+ *speed = le16_to_cpu(__speed);
return 0;
}
--
2.39.2
next reply other threads:[~2024-06-06 18:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-06 18:05 Guenter Roeck [this message]
2024-06-06 19:53 ` [PATCH] hwmon: (cros-ec_hwmon) Fix access to restricted __le16 Thomas Weißschuh
2024-06-06 20:16 ` Guenter Roeck
2024-06-06 20:48 ` Thomas Weißschuh
2024-06-06 21:15 ` Guenter Roeck
2024-06-07 10:10 ` patchwork-bot+chrome-platform
2024-06-07 10:10 ` patchwork-bot+chrome-platform
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=20240606180507.3332237-1-linux@roeck-us.net \
--to=linux@roeck-us.net \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=tzungbi@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