Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1730091
| From | Sean Fu <fxinrong@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] x86: Fix off-by-one error in loop termination. |
| Date | 2017-09-11 02:40 +0200 |
| Message-ID | <uokVA-3kc-9@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
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 <fxinrong@gmail.com> --- arch/x86/kernel/ksysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/ksysfs.c b/arch/x86/kernel/ksysfs.c index 4afc67f..cfde6c0 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: -- 2.6.2
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] x86: Fix off-by-one error in loop termination. Sean Fu <fxinrong@gmail.com> - 2017-09-11 02:40 +0200 Re: [PATCH] x86: Fix off-by-one error in loop termination. Sean Fu <fxinrong@gmail.com> - 2017-09-11 03:00 +0200 [tip:x86/urgent] x86/sysfs: Fix off-by-one error in loop termination tip-bot for Sean Fu <tipbot@zytor.com> - 2017-09-25 12:20 +0200
csiph-web