All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Martin J. Bligh" <mbligh@aracnet.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] 2/7 Fix potential NULL pointer
Date: Fri, 28 Feb 2003 13:33:52 -0800	[thread overview]
Message-ID: <361220000.1046468032@flay> (raw)

translation_table could be unintialised on machines other than NUMA-Q.
You never see this, as the compiler happens to optimise it away, but
it's still a Really Bad Idea (tm). Thanks to someone whose name I have
unfortunately forgotten for pointing this out.

Has been tested in my tree for over two weeks on UP, SMP, and NUMA and 
compile tested against a variety of different configs.


diff -urpN -X /home/fletch/.diff.exclude 010-local_pgdat/arch/i386/kernel/mpparse.c 011-mpc_apic_id/arch/i386/kernel/mpparse.c
--- 010-local_pgdat/arch/i386/kernel/mpparse.c	Tue Feb 25 23:03:43 2003
+++ 011-mpc_apic_id/arch/i386/kernel/mpparse.c	Fri Feb 28 08:05:34 2003
@@ -110,7 +110,7 @@ void __init MP_processor_info (struct mp
 	if (!(m->mpc_cpuflag & CPU_ENABLED))
 		return;
 
-	apicid = mpc_apic_id(m, translation_table[mpc_record]->trans_quad);
+	apicid = mpc_apic_id(m, translation_table[mpc_record]);
 
 	if (m->mpc_featureflag&(1<<0))
 		Dprintk("    Floating point unit present.\n");
diff -urpN -X /home/fletch/.diff.exclude 010-local_pgdat/include/asm-i386/mach-bigsmp/mach_apic.h 011-mpc_apic_id/include/asm-i386/mach-bigsmp/mach_apic.h
--- 010-local_pgdat/include/asm-i386/mach-bigsmp/mach_apic.h	Fri Jan 17 09:18:31 2003
+++ 011-mpc_apic_id/include/asm-i386/mach-bigsmp/mach_apic.h	Fri Feb 28 08:05:34 2003
@@ -87,7 +87,8 @@ static inline int cpu_to_logical_apicid(
        return (int)cpu_2_logical_apicid[cpu];
  }
 
-static inline int mpc_apic_id(struct mpc_config_processor *m, int quad)
+static inline int mpc_apic_id(struct mpc_config_processor *m,
+			struct mpc_config_translation *translation_record)
 {
 	printk("Processor #%d %ld:%ld APIC version %d\n",
 	        m->mpc_apicid,
diff -urpN -X /home/fletch/.diff.exclude 010-local_pgdat/include/asm-i386/mach-default/mach_apic.h 011-mpc_apic_id/include/asm-i386/mach-default/mach_apic.h
--- 010-local_pgdat/include/asm-i386/mach-default/mach_apic.h	Fri Jan 17 09:18:31 2003
+++ 011-mpc_apic_id/include/asm-i386/mach-default/mach_apic.h	Fri Feb 28 08:05:34 2003
@@ -79,7 +79,8 @@ static inline unsigned long apicid_to_cp
 	return (1ul << phys_apicid);
 }
 
-static inline int mpc_apic_id(struct mpc_config_processor *m, int quad)
+static inline int mpc_apic_id(struct mpc_config_processor *m, 
+			struct mpc_config_translation *translation_record)
 {
 	printk("Processor #%d %ld:%ld APIC version %d\n",
 			m->mpc_apicid,
diff -urpN -X /home/fletch/.diff.exclude 010-local_pgdat/include/asm-i386/mach-numaq/mach_apic.h 011-mpc_apic_id/include/asm-i386/mach-numaq/mach_apic.h
--- 010-local_pgdat/include/asm-i386/mach-numaq/mach_apic.h	Fri Jan 17 09:18:31 2003
+++ 011-mpc_apic_id/include/asm-i386/mach-numaq/mach_apic.h	Fri Feb 28 08:05:34 2003
@@ -73,8 +73,10 @@ static inline unsigned long apicid_to_cp
 	return ( (logical_apicid&0xf) << (4*apicid_to_node(logical_apicid)) );
 }
 
-static inline int mpc_apic_id(struct mpc_config_processor *m, int quad)
+static inline int mpc_apic_id(struct mpc_config_processor *m, 
+			struct mpc_config_translation *translation_record)
 {
+	int quad = translation_record->trans_quad;
 	int logical_apicid = generate_logical_apicid(quad, m->mpc_apicid);
 
 	printk("Processor #%d %ld:%ld APIC version %d (quad %d, apic %d)\n",
diff -urpN -X /home/fletch/.diff.exclude 010-local_pgdat/include/asm-i386/mach-summit/mach_apic.h 011-mpc_apic_id/include/asm-i386/mach-summit/mach_apic.h
--- 010-local_pgdat/include/asm-i386/mach-summit/mach_apic.h	Sat Feb 15 16:11:45 2003
+++ 011-mpc_apic_id/include/asm-i386/mach-summit/mach_apic.h	Fri Feb 28 08:05:34 2003
@@ -90,7 +90,8 @@ static inline unsigned long apicid_to_cp
 		return (1ul << apicid);
 }
 
-static inline int mpc_apic_id(struct mpc_config_processor *m, int quad)
+static inline int mpc_apic_id(struct mpc_config_processor *m, 
+			struct mpc_config_translation *translation_record)
 {
 	printk("Processor #%d %ld:%ld APIC version %d\n",
 			m->mpc_apicid,


                 reply	other threads:[~2003-02-28 21:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=361220000.1046468032@flay \
    --to=mbligh@aracnet.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.