x86: ksysfs: small memory leak on error
Subsystems (2)
PATCH 1/1 x86: ksysfs: small memory leak on error
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 <[email protected]>
arch/x86/kernel/ksysfs.c +1 -1
@@ -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:
Quoted 2 lines · Dan Carpenter
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.
Quoted 16 lines
Fixes 5039e316dde3 ('x86: Export x86 boot_params to sysfs')Signed-off-by Dan Carpenter <[email protected]>arch/x86/kernel/ksysfs.c +1
-1@@ -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:
Quoted 10 lines · Dan Carpenter
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 <[email protected]>arch/x86/kernel/ksysfs.c +0
-0
arch/x86/kernel/ksysfs.c static int __init create_setup_data_nodes(struct kobject *parent) · line 305
Quoted 8 lines
arch/x86/kernel/ksysfs.c +1
-1@@ -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 <[email protected]>
Thanks
Dave