On Wed, May 31, 2017 at 10:08 AM, Borislav Petkov <[email protected]> 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

Reply via email to