Re: [PATCH] hwmon: Fix possible NULL pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 31, 2022 at 04:27:40PM +0000, Paul Cercueil wrote:
> The recent addition of the label attribute added some code that read the
> "label" device property, without checking first that "dev" was non-NULL.
> 
> Fix this issue by first checking that "dev" is non-NULL.
> 
> Fixes: ccd98cba6a18 ("hwmon: Add "label" attribute")
> Signed-off-by: Paul Cercueil <paul@xxxxxxxxxxxxxxx>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/hwmon.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
> index e36ea82da147..5915fedee69b 100644
> --- a/drivers/hwmon/hwmon.c
> +++ b/drivers/hwmon/hwmon.c
> @@ -807,7 +807,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
>  		hdev->groups = groups;
>  	}
>  
> -	if (device_property_present(dev, "label")) {
> +	if (dev && device_property_present(dev, "label")) {
>  		err = device_property_read_string(dev, "label", &label);
>  		if (err < 0)
>  			goto free_hwmon;
> -- 
> 2.34.1
> 



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux