aboutsummaryrefslogtreecommitdiff
path: root/drivers/hwmon/cros_ec_hwmon.c
AgeCommit message (Collapse)AuthorFilesLines
2024-06-07hwmon: (cros_ec) Fix access to restricted __le16Guenter Roeck1-2/+3
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> Acked-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20240606180507.3332237-1-linux@roeck-us.net Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
2024-06-07hwmon: (cros_ec) Prevent read overflow in probe()Dan Carpenter1-1/+1
The "resp.sensor_name" comes from cros_ec_cmd() and it hasn't necessarily been NUL terminated. We had not intended to read past "sensor_name_size" bytes, however, there is a width vs precision bug in the format string. The format needs to be precision '%.*s' instead of width '%*s'. Precision prevents an out of bounds read, but width is a no-op. Fixes: bc3e45258096 ("hwmon: add ChromeOS EC driver") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/42331b70-bd3c-496c-8c79-3ec4faad40b8@moroto.mountain Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
2024-06-03hwmon: add ChromeOS EC driverThomas Weißschuh1-0/+282
The ChromeOS Embedded Controller exposes fan speed and temperature readings. Expose this data through the hwmon subsystem. The driver is designed to be probed via the cros_ec mfd device. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20240529-cros_ec-hwmon-v4-2-5cdf0c5db50a@weissschuh.net [tzungbi: Fixed typo in MAINTAINERS: "chros_ec_hwmon" -> "cros_ec_hwmon"] Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>