From: Josh Poimboeuf <jpoimboe@redhat.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: Peter Zijlstra <peterz@infradead.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] objtool: check: Fix NULL pointer dereference
Date: Tue, 31 Mar 2020 17:04:05 -0500 [thread overview]
Message-ID: <20200331220405.2zopmakvcgytfze5@treble> (raw)
In-Reply-To: <20200331002040.GA11302@embeddedor>
On Mon, Mar 30, 2020 at 07:20:40PM -0500, Gustavo A. R. Silva wrote:
> In case func is null, there is a null pointer dereference at 2029:
>
> 2029 WARN("%s uses BP as a scratch register",
> 2030 func->name);
>
> Fix this by null-checking func.
>
> Addresses-Coverity-ID: 1492002 ("Dereference after null check")
> Fixes: c705cecc8431 ("objtool: Track original function across branches")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
> tools/objtool/check.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index e3bb76358148..182cc48fa892 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -2025,7 +2025,7 @@ static int validate_return(struct symbol *func, struct instruction *insn, struct
> return 1;
> }
>
> - if (state->bp_scratch) {
> + if (func && state->bp_scratch) {
> WARN("%s uses BP as a scratch register",
> func->name);
> return 1;
We should still do the warning even if there's no func. I'll make a
slightly different patch which unconditionally uses WARN_FUNC().
I'll give you Reported-by credit and keep the coverity tag. Thanks!
--
Josh
next prev parent reply other threads:[~2020-03-31 22:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-31 0:20 Gustavo A. R. Silva
2020-03-31 22:04 ` Josh Poimboeuf [this message]
2020-03-31 22:27 ` Gustavo A. R. Silva
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=20200331220405.2zopmakvcgytfze5@treble \
--to=jpoimboe@redhat.com \
--cc=gustavo@embeddedor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
/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®