mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] check the kzalloc return value
@ 2012-10-22 15:56 Denis Kirjanov
  2012-10-23 15:42 ` Borislav Petkov
  0 siblings, 1 reply; 3+ messages in thread
From: Denis Kirjanov @ 2012-10-22 15:56 UTC (permalink / raw)
  To: dougthompson; +Cc: linux-edac, linux-kernel, Denis Kirjanov


Signed-off-by: Denis Kirjanov <kirjanov@gmail.com>
---
 drivers/edac/edac_mc_sysfs.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index ed0bc07..55ce016 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -1128,7 +1128,8 @@ int __init edac_mc_sysfs_init(void)
 	}
 
 	mci_pdev = kzalloc(sizeof(*mci_pdev), GFP_KERNEL);
-
+	if (!mci_pdev)
+		return -ENOMEM;
 	mci_pdev->bus = edac_subsys;
 	mci_pdev->type = &mc_attr_type;
 	device_initialize(mci_pdev);
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] check the kzalloc return value
  2012-10-22 15:56 [PATCH] check the kzalloc return value Denis Kirjanov
@ 2012-10-23 15:42 ` Borislav Petkov
  2012-10-23 15:47   ` Denis Kirjanov
  0 siblings, 1 reply; 3+ messages in thread
From: Borislav Petkov @ 2012-10-23 15:42 UTC (permalink / raw)
  To: Denis Kirjanov; +Cc: linux-edac, linux-kernel

On Mon, Oct 22, 2012 at 07:56:04PM +0400, Denis Kirjanov wrote:
> 

Needs a commit message.

> Signed-off-by: Denis Kirjanov <kirjanov@gmail.com>
> ---
>  drivers/edac/edac_mc_sysfs.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
> index ed0bc07..55ce016 100644
> --- a/drivers/edac/edac_mc_sysfs.c
> +++ b/drivers/edac/edac_mc_sysfs.c
> @@ -1128,7 +1128,8 @@ int __init edac_mc_sysfs_init(void)
>  	}
>  
>  	mci_pdev = kzalloc(sizeof(*mci_pdev), GFP_KERNEL);
> -
> +	if (!mci_pdev)
> +		return -ENOMEM;

This either needs to do

	edac_put_sysfs_subsys();

on the error-out path.

>  	mci_pdev->bus = edac_subsys;
>  	mci_pdev->type = &mc_attr_type;
>  	device_initialize(mci_pdev);

Thanks.

-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] check the kzalloc return value
  2012-10-23 15:42 ` Borislav Petkov
@ 2012-10-23 15:47   ` Denis Kirjanov
  0 siblings, 0 replies; 3+ messages in thread
From: Denis Kirjanov @ 2012-10-23 15:47 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: linux-edac, linux-kernel

I'll resubmit a new patch.

Thanks!

On 10/23/12, Borislav Petkov <bp@amd64.org> wrote:
> On Mon, Oct 22, 2012 at 07:56:04PM +0400, Denis Kirjanov wrote:
>>
>
> Needs a commit message.
>
>> Signed-off-by: Denis Kirjanov <kirjanov@gmail.com>
>> ---
>>  drivers/edac/edac_mc_sysfs.c |    3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
>> index ed0bc07..55ce016 100644
>> --- a/drivers/edac/edac_mc_sysfs.c
>> +++ b/drivers/edac/edac_mc_sysfs.c
>> @@ -1128,7 +1128,8 @@ int __init edac_mc_sysfs_init(void)
>>  	}
>>
>>  	mci_pdev = kzalloc(sizeof(*mci_pdev), GFP_KERNEL);
>> -
>> +	if (!mci_pdev)
>> +		return -ENOMEM;
>
> This either needs to do
>
> 	edac_put_sysfs_subsys();
>
> on the error-out path.
>
>>  	mci_pdev->bus = edac_subsys;
>>  	mci_pdev->type = &mc_attr_type;
>>  	device_initialize(mci_pdev);
>
> Thanks.
>
> --
> Regards/Gruss,
> Boris.
>
> Advanced Micro Devices GmbH
> Einsteinring 24, 85609 Dornach
> GM: Alberto Bozzo
> Reg: Dornach, Landkreis Muenchen
> HRB Nr. 43632 WEEE Registernr: 129 19551
>


-- 
Regards,
Denis

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-23 15:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-22 15:56 [PATCH] check the kzalloc return value Denis Kirjanov
2012-10-23 15:42 ` Borislav Petkov
2012-10-23 15:47   ` Denis Kirjanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®