public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Any reason why we don't initialize all members of struct Xgt_desc_struct in doublefault.c ?
@ 2004-11-24 23:21 Jesper Juhl
  2004-11-25 16:45 ` Zwane Mwaikambo
  2004-11-26 15:14 ` Jeff Garzik
  0 siblings, 2 replies; 5+ messages in thread
From: Jesper Juhl @ 2004-11-24 23:21 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm


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@dif.dk>

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@dif.dk>

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-11-30  3:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-24 23:21 Any reason why we don't initialize all members of struct Xgt_desc_struct in doublefault.c ? Jesper Juhl
2004-11-25 16:45 ` Zwane Mwaikambo
2004-11-26 15:14 ` Jeff Garzik
2004-11-26 15:24   ` Jesper Juhl
2004-11-26 20:24   ` Andreas Dilger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox