re: thermal: sysfs: lock tz when access sustainable power properties

From: Dan Carpenter <hidden>
Date: 2016-06-02 14:47:18

Hello Eduardo Valentin,

This is a semi-automatic email about new static checker warnings.

The patch 58601ec845aa: "thermal: sysfs: lock tz when access 
sustainable power properties" from May 30, 2016, leads to the 
following Smatch complaint:

drivers/thermal/thermal_sysfs.c:376 sustainable_power_show()
	 warn: variable dereferenced before check 'tz->tzp' (see line 373)

drivers/thermal/thermal_sysfs.c
   372		mutex_lock(&tz->lock);
   373		sustainable_power = tz->tzp->sustainable_power;
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
New dereference.

   374		mutex_unlock(&tz->lock);
   375	
   376		if (tz->tzp)
                    ^^^^^^^
Old code assumed this could be NULL.

   377			return sprintf(buf, "%u\n", sustainable_power);
   378		else

regards,
dan carpenter
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help