Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 cleanups from Ingo Molnar: "Two cleanups in the LDT handling code, by Dan Carpenter and Thomas Gleixner" * 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/ldt: Make all size computations unsigned x86/ldt: Make a size argument unsigned
This commit is contained in:
commit
ef486c599a
|
@ -2303,7 +2303,7 @@ valid_user_frame(const void __user *fp, unsigned long size)
|
||||||
static unsigned long get_segment_base(unsigned int segment)
|
static unsigned long get_segment_base(unsigned int segment)
|
||||||
{
|
{
|
||||||
struct desc_struct *desc;
|
struct desc_struct *desc;
|
||||||
int idx = segment >> 3;
|
unsigned int idx = segment >> 3;
|
||||||
|
|
||||||
if ((segment & SEGMENT_TI_MASK) == SEGMENT_LDT) {
|
if ((segment & SEGMENT_TI_MASK) == SEGMENT_LDT) {
|
||||||
#ifdef CONFIG_MODIFY_LDT_SYSCALL
|
#ifdef CONFIG_MODIFY_LDT_SYSCALL
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct ldt_struct {
|
||||||
* allocations, but it's not worth trying to optimize.
|
* allocations, but it's not worth trying to optimize.
|
||||||
*/
|
*/
|
||||||
struct desc_struct *entries;
|
struct desc_struct *entries;
|
||||||
int size;
|
unsigned int size;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -34,10 +34,10 @@ static void flush_ldt(void *current_mm)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The caller must call finalize_ldt_struct on the result. LDT starts zeroed. */
|
/* 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;
|
struct ldt_struct *new_ldt;
|
||||||
int alloc_size;
|
unsigned int alloc_size;
|
||||||
|
|
||||||
if (size > LDT_ENTRIES)
|
if (size > LDT_ENTRIES)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -207,11 +207,11 @@ static int read_default_ldt(void __user *ptr, unsigned long bytecount)
|
||||||
static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
|
static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
|
||||||
{
|
{
|
||||||
struct mm_struct *mm = current->mm;
|
struct mm_struct *mm = current->mm;
|
||||||
|
struct ldt_struct *new_ldt, *old_ldt;
|
||||||
|
unsigned int oldsize, newsize;
|
||||||
|
struct user_desc ldt_info;
|
||||||
struct desc_struct ldt;
|
struct desc_struct ldt;
|
||||||
int error;
|
int error;
|
||||||
struct user_desc ldt_info;
|
|
||||||
int oldsize, newsize;
|
|
||||||
struct ldt_struct *new_ldt, *old_ldt;
|
|
||||||
|
|
||||||
error = -EINVAL;
|
error = -EINVAL;
|
||||||
if (bytecount != sizeof(ldt_info))
|
if (bytecount != sizeof(ldt_info))
|
||||||
|
@ -249,7 +249,7 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
|
||||||
|
|
||||||
old_ldt = mm->context.ldt;
|
old_ldt = mm->context.ldt;
|
||||||
oldsize = old_ldt ? old_ldt->size : 0;
|
oldsize = old_ldt ? old_ldt->size : 0;
|
||||||
newsize = max((int)(ldt_info.entry_number + 1), oldsize);
|
newsize = max(ldt_info.entry_number + 1, oldsize);
|
||||||
|
|
||||||
error = -ENOMEM;
|
error = -ENOMEM;
|
||||||
new_ldt = alloc_ldt_struct(newsize);
|
new_ldt = alloc_ldt_struct(newsize);
|
||||||
|
|
Loading…
Reference in New Issue