x86: cleanup - eliminate numbers in LDT allocation code
PATCH 1/1 x86: cleanup - eliminate numbers in LDT allocation code
This patch eliminates numbers in LDT allocation code trying to make it clear to understand from where these numbers are go
Signed-off-by Cyrill Gorcunov <[email protected]>
---
I hope nobody shoot me ;)
arch/x86/kernel/ldt.c +2 -1
@@ -35,7 +35,8 @@ static int alloc_ldt(mm_context_t *pc, iif (mincount <= pc->size)return 0 ; oldsize = pc->size; - mincount = (mincount +511 ) & (~511 ); + mincount = (mincount + (PAGE_SIZE /LDT_ENTRY_SIZE -1 )) & + (~(PAGE_SIZE /LDT_ENTRY_SIZE -1 ));if (mincount *LDT_ENTRY_SIZE >PAGE_SIZE ) newldt =vmalloc (mincount *LDT_ENTRY_SIZE );else
Ingo Molnar
AppliedQuoted 2 lines · Cyrill Gorcunov
This patch eliminates numbers in LDT allocation code trying to make it clear to understand from where these numbers are go
thanks, applied.
Quoted 1 line
I hope nobody shoot me ;)
nope, magic constants are bad in general.
Ingo
[Ingo Molnar - Fri, Feb 01, 2008 at 06:18:26PM +0100]
| | * Cyrill Gorcunov <[email protected]> wrote: | | > This patch eliminates numbers in LDT allocation code trying to make it | > clear to understand from where these numbers are go | | thanks, applied. | | > I hope nobody shoot me ;) | | nope, magic constants are bad in general. | | Ingo |
Thanks Ingo, and really thanks to Andi for his
explanation on this case.
- Cyrill -