* [PATCH] objtool: orc_gen: Fix memory leak in create_orc_entry
@ 2020-04-27 13:35 Gustavo A. R. Silva
2020-04-27 14:44 ` Josh Poimboeuf
0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2020-04-27 13:35 UTC (permalink / raw)
To: Josh Poimboeuf, Peter Zijlstra; +Cc: linux-kernel, Gustavo A. R. Silva
In case memory resources for rela were allocated, release them before
return.
Addresses-Coverity-ID: 1462331 ("Resource leak")
Fixes: e81e07244325 ("objtool: Support Clang non-section symbols in ORC generation")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
tools/objtool/orc_gen.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/objtool/orc_gen.c b/tools/objtool/orc_gen.c
index 4c0dabd28000..07b67b1576d7 100644
--- a/tools/objtool/orc_gen.c
+++ b/tools/objtool/orc_gen.c
@@ -120,6 +120,7 @@ static int create_orc_entry(struct elf *elf, struct section *u_sec, struct secti
if (!rela->sym) {
WARN("missing symbol for insn at offset 0x%lx\n",
insn_off);
+ free(rela);
return -1;
}
--
2.26.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] objtool: orc_gen: Fix memory leak in create_orc_entry
2020-04-27 13:35 [PATCH] objtool: orc_gen: Fix memory leak in create_orc_entry Gustavo A. R. Silva
@ 2020-04-27 14:44 ` Josh Poimboeuf
2020-04-27 17:28 ` Gustavo A. R. Silva
0 siblings, 1 reply; 3+ messages in thread
From: Josh Poimboeuf @ 2020-04-27 14:44 UTC (permalink / raw)
To: Gustavo A. R. Silva; +Cc: Peter Zijlstra, linux-kernel
On Mon, Apr 27, 2020 at 08:35:33AM -0500, Gustavo A. R. Silva wrote:
> In case memory resources for rela were allocated, release them before
> return.
>
> Addresses-Coverity-ID: 1462331 ("Resource leak")
> Fixes: e81e07244325 ("objtool: Support Clang non-section symbols in ORC generation")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Hi Gustavo,
For performance reasons, our policy is to allow memory leaks in error
and exit paths. So you may want to turn off Coverity resource leak
checking for objtool.
--
Josh
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] objtool: orc_gen: Fix memory leak in create_orc_entry
2020-04-27 14:44 ` Josh Poimboeuf
@ 2020-04-27 17:28 ` Gustavo A. R. Silva
0 siblings, 0 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2020-04-27 17:28 UTC (permalink / raw)
To: Josh Poimboeuf; +Cc: Peter Zijlstra, linux-kernel
Hi Josh,
On 4/27/20 09:44, Josh Poimboeuf wrote:
> On Mon, Apr 27, 2020 at 08:35:33AM -0500, Gustavo A. R. Silva wrote:
>> In case memory resources for rela were allocated, release them before
>> return.
>>
>> Addresses-Coverity-ID: 1462331 ("Resource leak")
>> Fixes: e81e07244325 ("objtool: Support Clang non-section symbols in ORC generation")
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>
> Hi Gustavo,
>
> For performance reasons, our policy is to allow memory leaks in error
> and exit paths. So you may want to turn off Coverity resource leak
> checking for objtool.
>
Got it. That's good to know.
Thank you.
--
Gustavo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-27 17:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-27 13:35 [PATCH] objtool: orc_gen: Fix memory leak in create_orc_entry Gustavo A. R. Silva
2020-04-27 14:44 ` Josh Poimboeuf
2020-04-27 17:28 ` Gustavo A. R. Silva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox