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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <4FBB17D7.8080107@samsung.com>
Date:	Tue, 22 May 2012 13:36:39 +0900
From:	jonghwa3.lee@...sung.com
To:	David Rientjes <rientjes@...gle.com>
Cc:	linux-kernel@...r.kernel.org, Samuel Oritz <sameo@...ux.intel.com>,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	Liam Gridwodd <lrg@...com>,
	Alessandro Zummo <a.zummo@...ertech.it>,
	Kyungmin Park <kyungmin.park@...sung.com>,
	MyungJoo Ham <myungjoo.ham@...sung.com>,
	Chanwoo Choi <cw00.choi@...sung.com>,
	Chiwoong Byun <woong.byun@...sung.com>
Subject: Re: [PATCH v4 2/3] regulator: MAX77686: Add Maxim 77686 regulator
 driver

On 2012년 05월 22일 06:06, David Rientjes wrote:

> On Mon, 21 May 2012, Jonghwa Lee wrote:
>> +static __devinit int max77686_pmic_probe(struct platform_device *pdev)
>> +{
>> +	struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent);
>> +	struct max77686_platform_data *pdata = dev_get_platdata(iodev->dev);
>> +	struct regulator_dev **rdev;
>> +	struct max77686_data *max77686;
>> +	struct regulator_init_data **init_data;
>> +	int i, size;
>> +	int ret = 0;
>> +	struct regulator_config config;
>> +	unsigned int data = 0;
>> +
>> +	dev_dbg(&pdev->dev, "%s\n", __func__);
>> +
>> +	max77686 = devm_kzalloc(&pdev->dev, sizeof(struct max77686_data),
>> +				GFP_KERNEL);
>> +	if (!max77686)
>> +		return -ENOMEM;
>> +
>> +	size = sizeof(struct regulator_dev *) * MAX77686_REGULATORS;
>> +	max77686->rdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
>> +	if (!max77686->rdev)
>> +		return -ENOMEM;
> 
> Does this leak max77686?
>


It uses devm_kzalloc which automatically frees memory allocation when
the driver is detached. So we don't need to worry about it.

 
>> +
>> +	rdev = max77686->rdev;
>> +	max77686->dev = &pdev->dev;
>> +	max77686->iodev = iodev;
>> +	if (pdata)
>> +		max77686->num_regulators = pdata->num_regulators;
>> +	platform_set_drvdata(pdev, max77686);
>> +	init_data = devm_kzalloc(&pdev->dev,
>> +				sizeof(struct regulator_init_data *)
>> +					 * MAX77686_REGULATORS, GFP_KERNEL);
> 
> No error handling, which will cause a NULL pointer later when you use this 
> array.
> 


Okay, now i applied it.

> --
> 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/
> 


Thanks and Regard
--
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