Skip to contentSkip to conversation

drivers/char/agp/sgi-agp.c: check kmalloc() return value.

PATCH New Amit Choudhary 1 participant 1 message Mar 9, 2007 Agpgart driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/char/agp/sgi-agp.c: check kmalloc() return value.

Description: Check the return value of kmalloc() in function agp_sgi_init(), in file drivers/char/agp/sgi-agp.c.

drivers/char/agp/sgi-agp.c +2 -0
index d73be4c..5897e6c 100644
@@ -285,6 +285,8 @@ static int __devinit agp_sgi_init(void)
 	    (struct agp_bridge_data **)kmalloc(tioca_gart_found *
 					       sizeof(struct agp_bridge_data *),
 					       GFP_KERNEL);
+	if (!sgi_tioca_agp_bridges)
+		return -ENOMEM;
 
 	j = 0;
 	list_for_each_entry(info, &tioca_list, ca_list) {