From: Steven Rostedt <rostedt@goodmis.org>
To: Li Zhong <floridsleeves@gmail.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
jpoimboe@kernel.org, jbaron@akamai.com, ardb@kernel.org,
tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com
Subject: Re: [PATCH v1] arch/x86/kernel: check the return value of insn_decode_kernel()
Date: Tue, 6 Sep 2022 21:59:18 -0400 [thread overview]
Message-ID: <20220906215918.3fe20cca@gandalf.local.home> (raw)
In-Reply-To: <20220902074706.2211252-1-floridsleeves@gmail.com>
On Fri, 2 Sep 2022 00:47:06 -0700
Li Zhong <floridsleeves@gmail.com> wrote:
> @@ -20,9 +20,10 @@
> int arch_jump_entry_size(struct jump_entry *entry)
> {
> struct insn insn = {};
> + int ret;
>
> - insn_decode_kernel(&insn, (void *)jump_entry_code(entry));
> - BUG_ON(insn.length != 2 && insn.length != 5);
> + ret = insn_decode_kernel(&insn, (void *)jump_entry_code(entry));
It's highly unlikely that length will be 2 or 5 if ret is not zero (as it
is initialized to zero going into this function).
> + BUG_ON(ret < 0 || insn.length != 2 && insn.length != 5);
In any case, you need parenthesis around the && condition.
-- Steve
>
> return insn.length;
next prev parent reply other threads:[~2022-09-07 1:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-02 7:47 Li Zhong
2022-09-07 1:59 ` Steven Rostedt [this message]
2022-09-07 8:40 ` Li Zhong
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=20220906215918.3fe20cca@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=floridsleeves@gmail.com \
--cc=hpa@zytor.com \
--cc=jbaron@akamai.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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®