]> git.baikalelectronics.ru Git - kernel.git/commit
power: supply: Add error checking of psy desc during registration
authorAdam Thomson <Adam.Thomson.Opensource@diasemi.com>
Mon, 23 Apr 2018 14:10:58 +0000 (15:10 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Apr 2018 12:17:48 +0000 (14:17 +0200)
commit9a016e1dbbd987b5021e3f6ba55081eb76ac9c1e
treead1997c37414affaa46cc1ae97e7262085feebad
parent8252aa3b2c1fd36ab3bc86bda3f21224eab760e9
power: supply: Add error checking of psy desc during registration

Currently there's no error checking of this parameter in the
registration function and it's blindly added to psy class and
subsequently used as is. For example if this is NULL the call
to psy_register_thermal() will try to dereference the pointer
thus causing a kernel dump.

This commit updates the registration code to add some basic
checks on the desc pointer validity, name, and presence of
properties.

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/power/supply/power_supply_core.c