aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2009-05-01 16:25:11 -0400
committerIngo Molnar <mingo@elte.hu>2009-05-03 04:49:31 -0400
commit9a8709d44139748fe2e0ab56d20d8c384c8b65ad (patch)
tree624b9ff6b2f68b3a70f424413778ae741835b6ae
parent1cbac972ba28e706fa9ce4d4c81830040bc811ee (diff)
x86: uv - prevent NULL dereference in uv_system_init()
We may reach NULL dereference oops if kmalloc failed. Prevent it with explicit BUG_ON. [ Impact: more controlled assert in 'impossible' scenario ] Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Acked-by: Jack Steiner <steiner@sgi.com> LKML-Reference: <20090501202511.GE4633@lenovo> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 873bf7121e89..9d9e2281a829 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -569,15 +569,18 @@ void __init uv_system_init(void)
569 569
570 bytes = sizeof(struct uv_blade_info) * uv_num_possible_blades(); 570 bytes = sizeof(struct uv_blade_info) * uv_num_possible_blades();
571 uv_blade_info = kmalloc(bytes, GFP_KERNEL); 571 uv_blade_info = kmalloc(bytes, GFP_KERNEL);
572 BUG_ON(!uv_blade_info);
572 573
573 get_lowmem_redirect(&lowmem_redir_base, &lowmem_redir_size); 574 get_lowmem_redirect(&lowmem_redir_base, &lowmem_redir_size);
574 575
575 bytes = sizeof(uv_node_to_blade[0]) * num_possible_nodes(); 576 bytes = sizeof(uv_node_to_blade[0]) * num_possible_nodes();
576 uv_node_to_blade = kmalloc(bytes, GFP_KERNEL); 577 uv_node_to_blade = kmalloc(bytes, GFP_KERNEL);
578 BUG_ON(!uv_node_to_blade);
577 memset(uv_node_to_blade, 255, bytes); 579 memset(uv_node_to_blade, 255, bytes);
578 580
579 bytes = sizeof(uv_cpu_to_blade[0]) * num_possible_cpus(); 581 bytes = sizeof(uv_cpu_to_blade[0]) * num_possible_cpus();
580 uv_cpu_to_blade = kmalloc(bytes, GFP_KERNEL); 582 uv_cpu_to_blade = kmalloc(bytes, GFP_KERNEL);
583 BUG_ON(!uv_cpu_to_blade);
581 memset(uv_cpu_to_blade, 255, bytes); 584 memset(uv_cpu_to_blade, 255, bytes);
582 585
583 blade = 0; 586 blade = 0;