[PATCH 07/18] regulator: test of_regulator_register input before accessing it
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Sep 28 12:11:00 EDT 2020
On 9/28/20 5:50 PM, Marco Felsch wrote:
> Add simple parameter check to avoid possible NULL pointer dereferences.
>
> Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
For patches 05,06,07:
Reviewed-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
> drivers/regulator/core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index a767e383fb..6ea21a4609 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -163,6 +163,9 @@ int of_regulator_register(struct regulator_dev *rd, struct device_node *node)
> struct regulator_internal *ri;
> const char *name;
>
> + if (!rd || !node)
> + return -EINVAL;
> +
> rd->boot_on = of_property_read_bool(node, "regulator-boot-on");
>
> name = of_get_property(node, "regulator-name", NULL);
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list