All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] x86: ksysfs: small memory leak on error
@ 2015-01-15  8:21 Dan Carpenter
  2015-01-15  9:57 ` Dave Young
  2015-01-15 12:23 ` Dave Young
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2015-01-15  8:21 UTC (permalink / raw)
  To: kernel-janitors

The "> 0" should be ">= 0" so that we free the last entry.

Fixes: 5039e316dde3 ('x86: Export x86 boot_params to sysfs')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/arch/x86/kernel/ksysfs.c b/arch/x86/kernel/ksysfs.c
index c2bedae..b0cfb64 100644
--- a/arch/x86/kernel/ksysfs.c
+++ b/arch/x86/kernel/ksysfs.c
@@ -299,7 +299,7 @@ static int __init create_setup_data_nodes(struct kobject *parent)
 	return 0;
 
 out_clean_nodes:
-	for (j = i - 1; j > 0; j--)
+	for (j = i - 1; j >= 0; j--)
 		cleanup_setup_data_node(*(kobjp + j));
 	kfree(kobjp);
 out_setup_data_kobj:

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

* Re: [patch] x86: ksysfs: small memory leak on error
  2015-01-15  8:21 [patch] x86: ksysfs: small memory leak on error Dan Carpenter
@ 2015-01-15  9:57 ` Dave Young
  2015-01-15 12:23 ` Dave Young
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Young @ 2015-01-15  9:57 UTC (permalink / raw)
  To: kernel-janitors

On 01/15/15 at 11:21am, Dan Carpenter wrote:
> The "> 0" should be ">= 0" so that we free the last entry.
> 

ditto as the another patch, i=0 case has been handled in previous code so it
is not necessary to do it under goto label.

> Fixes: 5039e316dde3 ('x86: Export x86 boot_params to sysfs')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/arch/x86/kernel/ksysfs.c b/arch/x86/kernel/ksysfs.c
> index c2bedae..b0cfb64 100644
> --- a/arch/x86/kernel/ksysfs.c
> +++ b/arch/x86/kernel/ksysfs.c
> @@ -299,7 +299,7 @@ static int __init create_setup_data_nodes(struct kobject *parent)
>  	return 0;
>  
>  out_clean_nodes:
> -	for (j = i - 1; j > 0; j--)
> +	for (j = i - 1; j >= 0; j--)
>  		cleanup_setup_data_node(*(kobjp + j));
>  	kfree(kobjp);
>  out_setup_data_kobj:

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

* Re: [patch] x86: ksysfs: small memory leak on error
  2015-01-15  8:21 [patch] x86: ksysfs: small memory leak on error Dan Carpenter
  2015-01-15  9:57 ` Dave Young
@ 2015-01-15 12:23 ` Dave Young
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Young @ 2015-01-15 12:23 UTC (permalink / raw)
  To: kernel-janitors

On 01/15/15 at 11:21am, Dan Carpenter wrote:
> The "> 0" should be ">= 0" so that we free the last entry.
> 
> Fixes: 5039e316dde3 ('x86: Export x86 boot_params to sysfs')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/arch/x86/kernel/ksysfs.c b/arch/x86/kernel/ksysfs.c
> index c2bedae..b0cfb64 100644
> --- a/arch/x86/kernel/ksysfs.c
> +++ b/arch/x86/kernel/ksysfs.c
> @@ -299,7 +299,7 @@ static int __init create_setup_data_nodes(struct kobject *parent)
>  	return 0;
>  
>  out_clean_nodes:
> -	for (j = i - 1; j > 0; j--)
> +	for (j = i - 1; j >= 0; j--)
>  		cleanup_setup_data_node(*(kobjp + j));
>  	kfree(kobjp);
>  out_setup_data_kobj:

Acked-by: Dave Young <dyoung@redhat.com>

Thanks
Dave

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

end of thread, other threads:[~2015-01-15 12:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-15  8:21 [patch] x86: ksysfs: small memory leak on error Dan Carpenter
2015-01-15  9:57 ` Dave Young
2015-01-15 12:23 ` Dave Young

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.