* [PATCH 1/2] powerpc/nvram: Add missing kfree in error path
@ 2015-07-17 7:19 Christophe JAILLET
2015-07-17 7:20 ` [PATCH 2/2] powerpc/nvram: Fix function name in some errors messages Christophe JAILLET
2015-10-12 11:17 ` [1/2] powerpc/nvram: Add missing kfree in error path Michael Ellerman
0 siblings, 2 replies; 4+ messages in thread
From: Christophe JAILLET @ 2015-07-17 7:19 UTC (permalink / raw)
To: benh, paulus, mpe
Cc: linuxppc-dev, linux-kernel, kernel-janitors, Christophe JAILLET
If 'nvram_write_header' fails, then 'new_part' should be freed, otherwise,
there is a memory leak.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is *untested* because I have no way to trigger the error.
---
arch/powerpc/kernel/nvram_64.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index 1e703f8..574ff59 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -1079,6 +1079,7 @@ loff_t __init nvram_create_partition(const char *name, int sig,
if (rc <= 0) {
pr_err("nvram_create_os_partition: nvram_write_header "
"failed (%d)\n", rc);
+ kfree(new_part);
return rc;
}
list_add_tail(&new_part->partition, &free_part->partition);
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] powerpc/nvram: Fix function name in some errors messages.
2015-07-17 7:19 [PATCH 1/2] powerpc/nvram: Add missing kfree in error path Christophe JAILLET
@ 2015-07-17 7:20 ` Christophe JAILLET
2015-10-12 11:17 ` [2/2] " Michael Ellerman
2015-10-12 11:17 ` [1/2] powerpc/nvram: Add missing kfree in error path Michael Ellerman
1 sibling, 1 reply; 4+ messages in thread
From: Christophe JAILLET @ 2015-07-17 7:20 UTC (permalink / raw)
To: benh, paulus, mpe
Cc: linuxppc-dev, linux-kernel, kernel-janitors, Christophe JAILLET
'nvram_create_os_partition' should be 'nvram_create_partition'.
Use __func__ to have it right, as done elsewhere in this file.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
arch/powerpc/kernel/nvram_64.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index 574ff59..4dab163 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -1065,7 +1065,7 @@ loff_t __init nvram_create_partition(const char *name, int sig,
/* Create our OS partition */
new_part = kmalloc(sizeof(*new_part), GFP_KERNEL);
if (!new_part) {
- pr_err("nvram_create_os_partition: kmalloc failed\n");
+ pr_err("%s: kmalloc failed\n", __func__);
return -ENOMEM;
}
@@ -1077,8 +1077,7 @@ loff_t __init nvram_create_partition(const char *name, int sig,
rc = nvram_write_header(new_part);
if (rc <= 0) {
- pr_err("nvram_create_os_partition: nvram_write_header "
- "failed (%d)\n", rc);
+ pr_err("%s: nvram_write_header failed (%d)\n", __func__, rc);
kfree(new_part);
return rc;
}
@@ -1091,8 +1090,8 @@ loff_t __init nvram_create_partition(const char *name, int sig,
free_part->header.checksum = nvram_checksum(&free_part->header);
rc = nvram_write_header(free_part);
if (rc <= 0) {
- pr_err("nvram_create_os_partition: nvram_write_header "
- "failed (%d)\n", rc);
+ pr_err("%s: nvram_write_header failed (%d)\n",
+ __func__, rc);
return rc;
}
} else {
@@ -1106,11 +1105,12 @@ loff_t __init nvram_create_partition(const char *name, int sig,
tmp_index += NVRAM_BLOCK_LEN) {
rc = ppc_md.nvram_write(nv_init_vals, NVRAM_BLOCK_LEN, &tmp_index);
if (rc <= 0) {
- pr_err("nvram_create_partition: nvram_write failed (%d)\n", rc);
+ pr_err("%s: nvram_write failed (%d)\n",
+ __func__, rc);
return rc;
}
}
-
+
return new_part->index + NVRAM_HEADER_LEN;
}
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [1/2] powerpc/nvram: Add missing kfree in error path
2015-07-17 7:19 [PATCH 1/2] powerpc/nvram: Add missing kfree in error path Christophe JAILLET
2015-07-17 7:20 ` [PATCH 2/2] powerpc/nvram: Fix function name in some errors messages Christophe JAILLET
@ 2015-10-12 11:17 ` Michael Ellerman
1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2015-10-12 11:17 UTC (permalink / raw)
To: Christophe Jaillet, benh, paulus
Cc: kernel-janitors, Christophe JAILLET, linuxppc-dev, linux-kernel
On Fri, 2015-17-07 at 07:19:59 UTC, Christophe Jaillet wrote:
> If 'nvram_write_header' fails, then 'new_part' should be freed, otherwise,
> there is a memory leak.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/7d523187173294f6ae3b86a4
cheers
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [2/2] powerpc/nvram: Fix function name in some errors messages.
2015-07-17 7:20 ` [PATCH 2/2] powerpc/nvram: Fix function name in some errors messages Christophe JAILLET
@ 2015-10-12 11:17 ` Michael Ellerman
0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2015-10-12 11:17 UTC (permalink / raw)
To: Christophe Jaillet, benh, paulus
Cc: kernel-janitors, Christophe JAILLET, linuxppc-dev, linux-kernel
On Fri, 2015-17-07 at 07:20:00 UTC, Christophe Jaillet wrote:
> 'nvram_create_os_partition' should be 'nvram_create_partition'.
> Use __func__ to have it right, as done elsewhere in this file.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/b6080db4f4e8bf28717b8329
cheers
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-12 11:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-17 7:19 [PATCH 1/2] powerpc/nvram: Add missing kfree in error path Christophe JAILLET
2015-07-17 7:20 ` [PATCH 2/2] powerpc/nvram: Fix function name in some errors messages Christophe JAILLET
2015-10-12 11:17 ` [2/2] " Michael Ellerman
2015-10-12 11:17 ` [1/2] powerpc/nvram: Add missing kfree in error path Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).