x86: Fix off-by-one error in loop termination.
PATCH 2/2 x86: Fix off-by-one error in loop termination.
An off-by-one error in loop terminantion conditions in create_setup_data_nodes will lead to memory leak when create_setup_data_node return error.
Signed-off-by Sean Fu <[email protected]>
--- arch/x86/kernel/ksysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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:
Signature · 1 line
2.6.2