Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1538434

[patch] x86/ldt: make a size variable unsigned

From Dan Carpenter <dan.carpenter@oracle.com>
Newsgroups linux.kernel
Subject [patch] x86/ldt: make a size variable unsigned
Date 2016-12-08 12:10 +0100
Message-ID <sM4Km-5qs-29@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


My static checker complains that we put an upper bound on the "size"
variable but not a lower bound.  The checker is not smart enough to know
the possible ranges of "old_mm->context.ldt->size" from
init_new_context_ldt() so it thinks maybe it could be negative.

Let's make it unsigned to silence the warning and future proof the code
a bit.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c
index 4d12cdf2b453..d6320c63be45 100644
--- a/arch/x86/kernel/ldt.c
+++ b/arch/x86/kernel/ldt.c
@@ -34,7 +34,7 @@ static void flush_ldt(void *current_mm)
 }
 
 /* The caller must call finalize_ldt_struct on the result. LDT starts zeroed. */
-static struct ldt_struct *alloc_ldt_struct(int size)
+static struct ldt_struct *alloc_ldt_struct(unsigned int size)
 {
 	struct ldt_struct *new_ldt;
 	int alloc_size;

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[patch] x86/ldt: make a size variable unsigned Dan Carpenter <dan.carpenter@oracle.com> - 2016-12-08 12:10 +0100
  Re: [patch] x86/ldt: make a size variable unsigned Andy Lutomirski <luto@amacapital.net> - 2016-12-08 23:40 +0100
  Re: [patch] x86/ldt: make a size variable unsigned Thomas Gleixner <tglx@linutronix.de> - 2016-12-09 00:20 +0100
  [tip:x86/cleanups] x86/ldt: Make a size argument unsigned tip-bot for Dan Carpenter <tipbot@zytor.com> - 2016-12-10 09:20 +0100

csiph-web