All of lore.kernel.org
 help / color / mirror / Atom feed
From: Khaled ROMDHANI <khaledromdhani216@gmail.com>
To: peterz@infradead.org, jpoimboe@redhat.com, jbaron@akamai.com,
	rostedt@goodmis.org, ardb@kernel.org, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com
Cc: Khaled ROMDHANI <khaledromdhani216@gmail.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH-next] x86/kernel: Fix unchecked return value
Date: Sat, 15 May 2021 21:22:12 +0100	[thread overview]
Message-ID: <20210515202212.24836-1-khaledromdhani216@gmail.com> (raw)

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)));
 	BUG_ON(insn.length != 2 && insn.length != 5);
 
 	return insn.length;
-- 
2.17.1


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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-15 20:22 Khaled ROMDHANI [this message]
2021-05-15 20:36 ` [PATCH-next] x86/kernel: Fix unchecked return value Borislav Petkov
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=20210515202212.24836-1-khaledromdhani216@gmail.com \
    --to=khaledromdhani216@gmail.com \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jbaron@akamai.com \
    --cc=jpoimboe@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.