mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Hansen <dave@sr71.net>
To: tglx@linutronix.de
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	Dave Hansen <dave@sr71.net>,
	dave.hansen@linux.intel.com
Subject: [PATCH 1/3] x86 mpx: change return type of get_reg_offset()
Date: Tue, 18 Nov 2014 10:23:43 -0800	[thread overview]
Message-ID: <20141118182343.C3E0C629@viggo.jf.intel.com> (raw)
In-Reply-To: <20141118182342.64D1B3A5@viggo.jf.intel.com>


From: Dave Hansen <dave.hansen@linux.intel.com>

get_reg_offset() used to return the register contents themselves
instead of the register offset.  When it did that, it was an
unsigned long.  I changed it to return an integer _offset_
instead of the register.  But, I neglected to change the return
type of the function or the variables in which we store the
result of the call.

This fixes up the code to clear up the warnings from the smatch
bot:

New smatch warnings:
arch/x86/mm/mpx.c:178 mpx_get_addr_ref() warn: unsigned 'addr_offset' is never less than zero.
arch/x86/mm/mpx.c:184 mpx_get_addr_ref() warn: unsigned 'base_offset' is never less than zero.
arch/x86/mm/mpx.c:188 mpx_get_addr_ref() warn: unsigned 'indx_offset' is never less than zero.
arch/x86/mm/mpx.c:196 mpx_get_addr_ref() warn: unsigned 'addr_offset' is never less than zero.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: x86@kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
---

 b/arch/x86/mm/mpx.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff -puN arch/x86/mm/mpx.c~mpx_get_addr_ref-as-int arch/x86/mm/mpx.c
--- a/arch/x86/mm/mpx.c~mpx_get_addr_ref-as-int	2014-11-18 09:14:18.630053592 -0800
+++ b/arch/x86/mm/mpx.c	2014-11-18 09:14:18.633053728 -0800
@@ -102,8 +102,8 @@ enum reg_type {
 	REG_TYPE_BASE,
 };
 
-static unsigned long get_reg_offset(struct insn *insn, struct pt_regs *regs,
-				    enum reg_type type)
+static int get_reg_offset(struct insn *insn, struct pt_regs *regs,
+			  enum reg_type type)
 {
 	int regno = 0;
 
@@ -174,9 +174,8 @@ static unsigned long get_reg_offset(stru
  */
 static void __user *mpx_get_addr_ref(struct insn *insn, struct pt_regs *regs)
 {
-	unsigned long addr, addr_offset;
-	unsigned long base, base_offset;
-	unsigned long indx, indx_offset;
+	unsigned long addr, base, indx;
+	int addr_offset, base_offset, indx_offset;
 	insn_byte_t sib;
 
 	insn_get_modrm(insn);
_

  reply	other threads:[~2014-11-18 18:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-18 18:23 [PATCH 0/3] x86: MPX fixes for tip Dave Hansen
2014-11-18 18:23 ` Dave Hansen [this message]
2014-11-19 10:57   ` [tip:x86/mpx] x86 mpx: Change return type of get_reg_offset() tip-bot for Dave Hansen
2014-11-18 18:23 ` [PATCH 2/3] x86: cleanly separate use of asm-generic/mm_hooks.h Dave Hansen
2014-11-19 10:57   ` [tip:x86/mpx] x86: Cleanly " tip-bot for Dave Hansen
2014-11-18 18:23 ` [PATCH 3/3] make arch_unmap()/etc... available to all architectures Dave Hansen
2014-11-19 10:58   ` [tip:x86/mpx] mm: Make arch_unmap()/bprm_mm_init() " tip-bot for Dave Hansen

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=20141118182343.C3E0C629@viggo.jf.intel.com \
    --to=dave@sr71.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.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®