[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9c54fd98-7e59-4cfd-b005-64af558541b5@roeck-us.net>
Date: Tue, 13 Aug 2024 11:19:09 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Maximilian Luz <luzmaximilian@...il.com>
Cc: Jean Delvare <jdelvare@...e.com>, Hans de Goede <hdegoede@...hat.com>,
Ivor Wanders <ivor@...nders.net>, linux-kernel@...r.kernel.org,
linux-hwmon@...r.kernel.org
Subject: Re: [PATCH v4] hwmon: Add thermal sensor driver for Surface
Aggregator Module
On Sun, Aug 11, 2024 at 02:14:41AM +0200, Maximilian Luz wrote:
> Some of the newer Microsoft Surface devices (such as the Surface Book
> 3 and Pro 9) have thermal sensors connected via the Surface Aggregator
> Module (the embedded controller on those devices). Add a basic driver
> to read out the temperature values of those sensors.
>
> The EC can have up to 16 thermal sensors connected via a single
> sub-device, each providing temperature readings and a label string.
>
> Link: https://github.com/linux-surface/surface-aggregator-module/issues/59
> Reviewed-by: Hans de Goede <hdegoede@...hat.com>
> Co-developed-by: Ivor Wanders <ivor@...nders.net>
> Signed-off-by: Ivor Wanders <ivor@...nders.net>
> Signed-off-by: Maximilian Luz <luzmaximilian@...il.com>
Applied. One comment below, though.
> ---
> +
> + /*
> + * This should not fail unless the name in the returned struct is not
> + * null-terminated or someone changed something in the struct
> + * definitions above, since our buffer and struct have the same
> + * capacity by design. So if this fails, log an error message. Since
> + * the more likely cause is that the returned string isn't
> + * null-terminated, we might have received garbage (as opposed to just
> + * an incomplete string), so also fail the function.
> + */
> + status = strscpy(buf, name_rsp.name, buf_len);
> + if (status < 0) {
> + dev_err(&sdev->dev, "received non-null-terminated sensor name string\n");
> + return status;
> + }
If that ever happens, it will likely be permanent and clog the kernel log.
Normally I'd ask you to make it _once, but I am kind of tired right now of
having to explain to people that clogging the kernel log isn't really a
good idea - even more so if the message doesn't provide any real value.
Guenter
Powered by blists - more mailing lists