From: Josh Poimboeuf <jpoimboe@kernel.org>
To: coverity-bot <keescook@chromium.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Miroslav Benes <mbenes@suse.cz>,
linux-kernel@vger.kernel.org,
Mikulas Patocka <mpatocka@redhat.com>,
Borislav Petkov <bp@suse.de>, Yujie Liu <yujie.liu@intel.com>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
linux-next@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: Coverity: elf_create_prefix_symbol(): Resource leaks
Date: Tue, 8 Nov 2022 13:10:45 -0800 [thread overview]
Message-ID: <20221108211045.hba5t63xmo3wuej7@treble> (raw)
In-Reply-To: <202211041232.6071ACE@keescook>
On Fri, Nov 04, 2022 at 12:32:38PM -0700, coverity-bot wrote:
> Hello!
>
> This is an experimental semi-automated report about issues detected by
> Coverity from a scan of next-20221104 as part of the linux-next scan project:
> https://scan.coverity.com/projects/linux-next-weekly-scan
>
> You're getting this email because you were associated with the identified
> lines of code (noted below) that were touched by commits:
>
> Tue Nov 1 13:44:09 2022 +0100
> 9f2899fe36a6 ("objtool: Add option to generate prefix symbols")
>
> Coverity reported the following:
>
> *** CID 1527141: Resource leaks (RESOURCE_LEAK)
> tools/objtool/elf.c:833 in elf_create_prefix_symbol()
> 827 struct symbol *sym = calloc(1, sizeof(*sym));
> 828 size_t namelen = strlen(orig->name) + sizeof("__pfx_");
> 829 char *name = malloc(namelen);
> 830
> 831 if (!sym || !name) {
> 832 perror("malloc");
> vvv CID 1527141: Resource leaks (RESOURCE_LEAK)
> vvv Variable "sym" going out of scope leaks the storage it points to.
> 833 return NULL;
> 834 }
> 835
> 836 snprintf(name, namelen, "__pfx_%s", orig->name);
> 837
> 838 sym->name = name;
>
> If this is a false positive, please let us know so we can mark it as
> such, or teach the Coverity rules to be smarter. If not, please make
> sure fixes get into linux-next. :) For patches fixing this, please
> include these lines (but double-check the "Fixes" first):
>
> Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
> Addresses-Coverity-ID: 1527141 ("Resource leaks")
> Fixes: 9f2899fe36a6 ("objtool: Add option to generate prefix symbols")
Please disable resource leak checking in objtool. It's a short-lived
userspace tool for which we generally don't care about memory leaks.
--
Josh
prev parent reply other threads:[~2022-11-08 21:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-04 19:32 coverity-bot
2022-11-08 21:10 ` Josh Poimboeuf [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221108211045.hba5t63xmo3wuej7@treble \
--to=jpoimboe@kernel.org \
--cc=bp@suse.de \
--cc=gustavo@embeddedor.com \
--cc=keescook@chromium.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=mpatocka@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=yujie.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®