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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251125110848.23483-1-laura.nao@collabora.com>
Date: Tue, 25 Nov 2025 12:08:48 +0100
From: Laura Nao <laura.nao@...labora.com>
To: daniel.lezcano@...aro.org
Cc: andrew-ct.chen@...iatek.com,
	angelogioacchino.delregno@...labora.com,
	arnd@...db.de,
	bchihi@...libre.com,
	colin.i.king@...il.com,
	conor+dt@...nel.org,
	devicetree@...r.kernel.org,
	frank-w@...lic-files.de,
	fshao@...omium.org,
	kernel@...labora.com,
	krzk+dt@...nel.org,
	lala.lin@...iatek.com,
	laura.nao@...labora.com,
	linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org,
	linux-mediatek@...ts.infradead.org,
	linux-pm@...r.kernel.org,
	lukasz.luba@....com,
	matthias.bgg@...il.com,
	nfraprado@...labora.com,
	rafael@...nel.org,
	robh@...nel.org,
	rui.zhang@...el.com,
	srini@...nel.org,
	u.kleine-koenig@...libre.com,
	wenst@...omium.org
Subject: Re: [PATCH v4 3/9] thermal/drivers/mediatek/lvts: Fail probe if temp_factor is zero

On 11/24/25 18:56, Daniel Lezcano wrote:
> On 11/21/25 12:16, Laura Nao wrote:
>> temp_factor is used in lvts_temp_to_raw() and lvts_raw_to_temp(). If
>> platform data is incorrect and temp_factor is zero, it could cause a
>> division by zero. Fail the probe early to prevent a kernel crash.
>>
>> Signed-off-by: Laura Nao <laura.nao@...labora.com>
>> ---
>>   drivers/thermal/mediatek/lvts_thermal.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
>> index 1c54d0b75b1a..b49441d82ffd 100644
>> --- a/drivers/thermal/mediatek/lvts_thermal.c
>> +++ b/drivers/thermal/mediatek/lvts_thermal.c
>> @@ -1346,6 +1346,11 @@ static int lvts_probe(struct platform_device *pdev)
>>       if (irq < 0)
>>           return irq;
>>   +    if (!lvts_data->temp_factor)
>> +        return dev_err_probe(
>> +            dev, -EINVAL,
>> +            "temp_factor should never be zero; check platform data.\n");
>> + 
>
> From my POV, this is not really useful. The temp_factor is set for each version statically in the code. The scope is limited to the driver, IOW it is not a parameter other subsystems passes to the driver.
>
> If it is NULL, then shame on the submitter who did not test the driver before sending ;)
>

Ack - I'll drop the patch in the next revision.

Thanks,

Laura

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ