Re: [RFC PATCH] x86/ldt: Rename ldr_struct.size to .n_entries
From: Andy Lutomirski
Date: Wed May 31 2017 - 18:20:39 EST
On Wed, May 31, 2017 at 10:08 AM, Borislav Petkov <bp@xxxxxxxxx> wrote:
> Hey guys,
>
> do you have anything against the below renaming?
>
> ldt->size is simply confusing while it wants to be called ldt->n_entries
> as it is used like this throughout the code.
Agreed, but...
> static int read_ldt(void __user *ptr, unsigned long bytecount)
> {
> - int retval;
> - unsigned long size;
> struct mm_struct *mm = current->mm;
> + unsigned long num_entries;
> + int retval;
...
> - size = mm->context.ldt->size * LDT_ENTRY_SIZE;
> - if (size > bytecount)
> - size = bytecount;
> + num_entries = mm->context.ldt->n_entries * LDT_ENTRY_SIZE;
> + if (num_entries > bytecount)
> + num_entries = bytecount;
num_bytes, perhaps?
> @@ -248,7 +248,7 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
> mutex_lock(&mm->context.lock);
>
> old_ldt = mm->context.ldt;
> - oldsize = old_ldt ? old_ldt->size : 0;
> + oldsize = old_ldt ? old_ldt->n_entries : 0;
how about old_n_entries?
--Andy