lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <708755c1-9f78-4554-b0c7-6fb6f7715364@gmail.com>
Date: Tue, 13 Aug 2024 20:42:37 +0200
From: Maximilian Luz <luzmaximilian@...il.com>
To: Guenter Roeck <linux@...ck-us.net>
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 8/13/24 8:19 PM, Guenter Roeck wrote:
> 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.

Ah, I didn't even think about that. I can send in a follow-up patch if
you want me to.

Currently it should be fine since we are failing the whole driver if
this does not work out. But using dev_err_once() would be more
forward-thinking in case we ever change that.

Thanks!

Best regards,
Max

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ