Skip to content

Commit 5a2bafc

Browse files
committed
x86/idt: Use proper constants for table size
Use the actual struct size to calculate the IDT table size instead of hardcoded values. Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 94438af commit 5a2bafc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/x86/kernel/idt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ struct idt_data {
5151
#define TSKG(_vector, _gdt) \
5252
G(_vector, NULL, DEFAULT_STACK, GATE_TASK, DPL0, _gdt << 3)
5353

54+
#define IDT_TABLE_SIZE (IDT_ENTRIES * sizeof(gate_desc))
5455

5556
static bool idt_setup_done __initdata;
5657

@@ -168,7 +169,7 @@ static const __initconst struct idt_data early_pf_idts[] = {
168169
gate_desc idt_table[IDT_ENTRIES] __page_aligned_bss;
169170

170171
struct desc_ptr idt_descr __ro_after_init = {
171-
.size = (IDT_ENTRIES * 2 * sizeof(unsigned long)) - 1,
172+
.size = IDT_TABLE_SIZE - 1,
172173
.address = (unsigned long) idt_table,
173174
};
174175

0 commit comments

Comments
 (0)