]> git.karo-electronics.de Git - linux-beck.git/commitdiff
x86/ldt: Make a size argument unsigned
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 8 Dec 2016 10:56:03 +0000 (13:56 +0300)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 9 Dec 2016 23:24:39 +0000 (00:24 +0100)
My static checker complains that we put an upper bound on the "size"
argument 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>
Acked-by: Andy Lutomirski <luto@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: kernel-janitors@vger.kernel.org
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/20161208105602.GA11382@elgon.mountain
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/kernel/ldt.c

index 6707039b9032d98ebdb21b37769d4e400fa80cd0..e25b6681cc65b14ff35822a3028b26f8772d1575 100644 (file)
@@ -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;