lkml.org 
[lkml]   [2017]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFC PATCH] x86/ldt: Rename ldr_struct.size to .n_entries
On Wed, May 31, 2017 at 10:08 AM, Borislav Petkov <bp@alien8.de> 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

\
 
 \ /
  Last update: 2017-06-01 00:21    [W:0.058 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site