lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 6 Feb 2012 13:27:09 +0100 (CET)
From:	Jiri Kosina <jkosina@...e.cz>
To:	Przemo Firszt <przemo@...szt.eu>
Cc:	chris@...bagwell.com, pinglinux@...il.com,
	linuxwacom-devel@...ts.sourceforge.net,
	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
	Jeremy Fitzhardinge <jeremy@...p.org>
Subject: Re: [PATCH] HID: wacom: Fix invalid power_supply_powers calls

On Sun, 5 Feb 2012, Przemo Firszt wrote:

> power_supply_powers calls added in 35b4c01e29bdd9632dabf9784ed3486333f00427
> have to be called after power device is created. This patch also fixes the
> second call - it has to be "ac" instead of "battery"
> 
> Signed-off-by: Przemo Firszt <przemo@...szt.eu>
> Signed-off-by: Chris Bagwell <chris@...bagwell.com>

[ adding Jeremy to CC ]

> ---
>  drivers/hid/hid-wacom.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c
> index b47e58b..acab74c 100644
> --- a/drivers/hid/hid-wacom.c
> +++ b/drivers/hid/hid-wacom.c
> @@ -531,7 +531,6 @@ static int wacom_probe(struct hid_device *hdev,
>  	wdata->battery.type = POWER_SUPPLY_TYPE_BATTERY;
>  	wdata->battery.use_for_apm = 0;
>  
> -	power_supply_powers(&wdata->battery, &hdev->dev);
>  
>  	ret = power_supply_register(&hdev->dev, &wdata->battery);
>  	if (ret) {
> @@ -540,6 +539,8 @@ static int wacom_probe(struct hid_device *hdev,
>  		goto err_battery;
>  	}
>  
> +	power_supply_powers(&wdata->battery, &hdev->dev);
> +
>  	wdata->ac.properties = wacom_ac_props;
>  	wdata->ac.num_properties = ARRAY_SIZE(wacom_ac_props);
>  	wdata->ac.get_property = wacom_ac_get_property;
> @@ -547,14 +548,14 @@ static int wacom_probe(struct hid_device *hdev,
>  	wdata->ac.type = POWER_SUPPLY_TYPE_MAINS;
>  	wdata->ac.use_for_apm = 0;
>  
> -	power_supply_powers(&wdata->battery, &hdev->dev);
> -
>  	ret = power_supply_register(&hdev->dev, &wdata->ac);
>  	if (ret) {
>  		hid_warn(hdev,
>  			 "can't create ac battery attribute, err: %d\n", ret);
>  		goto err_ac;
>  	}
> +
> +	power_supply_powers(&wdata->ac, &hdev->dev);
>  #endif
>  	return 0;

Hmm, seems valid. How did you notice? Have you seen crashes because of 
wild pointers?

Thanks,

-- 
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ