linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Khaled ROMDHANI <khaledromdhani216@gmail.com>
Cc: peterz@infradead.org, jpoimboe@redhat.com, jbaron@akamai.com,
	rostedt@goodmis.org, ardb@kernel.org, tglx@linutronix.de,
	mingo@redhat.com, x86@kernel.org, hpa@zytor.com,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH-next] x86/kernel: Fix unchecked return value
Date: Sat, 15 May 2021 22:36:45 +0200	[thread overview]
Message-ID: <YKAw3Yl8c6nU1zng@zn.tnic> (raw)
In-Reply-To: <20210515202212.24836-1-khaledromdhani216@gmail.com>

On Sat, May 15, 2021 at 09:22:12PM +0100, Khaled ROMDHANI wrote:
> From the coverity scan analysis, the return value from
> insn_decode_kernel is not checked. It is a macro constructed
> from the insn_decode function which may fail and return
> negative integer. Fix this by explicitly checking the
> return value.
> 
> Addresses-Coverity: ("Unchecked return value")
> Signed-off-by: Khaled ROMDHANI <khaledromdhani216@gmail.com>
> ---
>  arch/x86/kernel/jump_label.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c
> index a762dc1c615e..bf0ea003b6e7 100644
> --- a/arch/x86/kernel/jump_label.c
> +++ b/arch/x86/kernel/jump_label.c
> @@ -23,7 +23,7 @@ int arch_jump_entry_size(struct jump_entry *entry)
>  {
>  	struct insn insn = {};
>  
> -	insn_decode_kernel(&insn, (void *)jump_entry_code(entry));
> +	WARN_ON(insn_decode_kernel(&insn, (void *)jump_entry_code(entry)));

I don't think coverity is smart enough to notice...

>  	BUG_ON(insn.length != 2 && insn.length != 5);
	^^^^^^^^^^^^^

... this line.


-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

  reply	other threads:[~2021-05-15 20:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-15 20:22 [PATCH-next] x86/kernel: Fix unchecked return value Khaled ROMDHANI
2021-05-15 20:36 ` Borislav Petkov [this message]
2021-05-15 20:51   ` Colin Ian King
2021-05-16 13:17     ` Khaled Romdhani

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=YKAw3Yl8c6nU1zng@zn.tnic \
    --to=bp@alien8.de \
    --cc=ardb@kernel.org \
    --cc=hpa@zytor.com \
    --cc=jbaron@akamai.com \
    --cc=jpoimboe@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=khaledromdhani216@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).