* [patch v2] x86/ldt: make a size variable unsigned
@ 2016-12-10 9:06 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2016-12-10 9:06 UTC (permalink / raw)
To: kernel-janitors
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. Also make alloc_size unsigned as well to match.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: change alloc_size
diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c
index 4d12cdf2b453..62ccc27428e4 100644
--- a/arch/x86/kernel/ldt.c
+++ b/arch/x86/kernel/ldt.c
@@ -34,10 +34,10 @@ 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;
+ unsigned int alloc_size;
if (size > LDT_ENTRIES)
return NULL;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-12-10 9:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-10 9:06 [patch v2] x86/ldt: make a size variable unsigned Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox