On 1/27/22 01:47, Paul Cercueil wrote:
Hi,
Le jeu., janv. 27 2022 at 11:52:45 +0300, Dan Carpenter <dan.carpenter@xxxxxxxxxx> a écrit :
Hello Paul Cercueil,
This is a semi-automatic email about new static checker warnings.
The patch 073c3ea6c530: "hwmon: Add "label" attribute" from Jan 10,
2022, leads to the following Smatch complaint:
drivers/hwmon/hwmon.c:825 __hwmon_device_register()
warn: variable dereferenced before check 'dev' (see line 810)
drivers/hwmon/hwmon.c
809
810 if (device_property_present(dev, "label")) {
^^^
The patch adds a new unchecked dereference
I will send a patch to address that.
I'm surprised that this function can be called with dev == NULL in the first place, though.
Originally it was needed for the thermal subsystem, which did not provide a parent
device. By the time that was reworked, it was (mis-)used by the Loongson-3 hwmon
driver (which was never reviewed by a hwmon maintainer and does pretty much
everything wrong).
Guenter