From: Roel Kluin Date: Tue, 19 May 2009 23:45:45 +0000 (+0200) Subject: lguest: beyond ARRAY_SIZE of cpu->arch.gdt X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=81b79b01d057f8c5a378c38d2f738775b972934a;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git lguest: beyond ARRAY_SIZE of cpu->arch.gdt Do not go beyond ARRAY_SIZE of cpu->arch.gdt Signed-off-by: Roel Kluin Signed-off-by: Rusty Russell --- diff --git a/drivers/lguest/segments.c b/drivers/lguest/segments.c index 7ede64ffeef9..482ed5a18750 100644 --- a/drivers/lguest/segments.c +++ b/drivers/lguest/segments.c @@ -150,7 +150,7 @@ void load_guest_gdt_entry(struct lg_cpu *cpu, u32 num, u32 lo, u32 hi) { /* We assume the Guest has the same number of GDT entries as the * Host, otherwise we'd have to dynamically allocate the Guest GDT. */ - if (num > ARRAY_SIZE(cpu->arch.gdt)) + if (num >= ARRAY_SIZE(cpu->arch.gdt)) kill_guest(cpu, "too many gdt entries %i", num); /* Set it up, then fix it. */