Any reason why we don't initialize all members of struct Xgt_desc_structin doublefault.c ?

From: Jesper Juhl
Date: Wed Nov 24 2004 - 18:30:54 EST



Yes, this is nitpicking, but I just can't leave small corners like this
unpolished ;)

in arch/i386/kernel/doublefault.c you will find this (line 20) :

struct Xgt_desc_struct gdt_desc = {0, 0};

but, struct Xgt_desc_struct has 3 members,

struct Xgt_desc_struct {
unsigned short size;
unsigned long address __attribute__((packed));
unsigned short pad;
} __attribute__ ((packed));

so why only initialize two of them explicitly?


Wouldn't this be nicer? :

Signed-off-by: Jesper Juhl <juhl-lkml@xxxxxx>

diff -up linux-2.6.10-rc2-bk9-orig/arch/i386/kernel/doublefault.c linux-2.6.10-rc2-bk9/arch/i386/kernel/doublefault.c
--- linux-2.6.10-rc2-bk9-orig/arch/i386/kernel/doublefault.c 2004-10-18 23:53:21.000000000 +0200
+++ linux-2.6.10-rc2-bk9/arch/i386/kernel/doublefault.c 2004-11-25 00:02:34.000000000 +0100
@@ -17,7 +17,7 @@ static unsigned long doublefault_stack[D

static void doublefault_fn(void)
{
- struct Xgt_desc_struct gdt_desc = {0, 0};
+ struct Xgt_desc_struct gdt_desc = {0, 0, 0};
unsigned long gdt, tss;

__asm__ __volatile__("sgdt %0": "=m" (gdt_desc): :"memory");


or, if we want to be completely explicit about it how about :

Signed-off-by: Jesper Juhl <juhl-lkml@xxxxxx>

diff -up linux-2.6.10-rc2-bk9-orig/arch/i386/kernel/doublefault.c linux-2.6.10-rc2-bk9/arch/i386/kernel/doublefault.c
--- linux-2.6.10-rc2-bk9-orig/arch/i386/kernel/doublefault.c 2004-10-18 23:53:21.000000000 +0200
+++ linux-2.6.10-rc2-bk9/arch/i386/kernel/doublefault.c 2004-11-25 00:06:18.000000000 +0100
@@ -17,7 +17,11 @@ static unsigned long doublefault_stack[D

static void doublefault_fn(void)
{
- struct Xgt_desc_struct gdt_desc = {0, 0};
+ struct Xgt_desc_struct gdt_desc = {
+ .size = 0,
+ .address = 0,
+ .pad = 0
+ };
unsigned long gdt, tss;

__asm__ __volatile__("sgdt %0": "=m" (gdt_desc): :"memory");


--
Jesper Juhl


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/