Re: SN files update for 2.4

From: Bjorn Helgaas <bjorn.helgaas_at_hp.com>
Date: 2003-09-05 05:02:55
On Wednesday 03 September 2003 4:23 pm, Erik Jacobson wrote:
> The attached patch is an update to the SN files that are in the 2.4 bitkeeper
> tree.

Thanks, I applied this (after converting CR/NL to NL).

I didn't read the patch, since it only touches sn files, but I did
notice several checks of kmalloc return values for "<= 0", which
seems wrong because kmalloc returns NULL for failure.  For example:

--- a/arch/ia64/sn/io/drivers/ioconfig_bus.c	Thu Sep  4 14:38:03 2003
+++ b/arch/ia64/sn/io/drivers/ioconfig_bus.c	Thu Sep  4 14:38:03 2003
@@ -162,8 +165,13 @@
 	struct ascii_moduleid *moduleid;
 
 	line = kmalloc(256, GFP_KERNEL);
+	if (line <= 0)
+		BUG(); /* Do not want to continue system boot .. */
 	memset(line, 0,256);
 	name = kmalloc(125, GFP_KERNEL);
+	if (name <= 0){
+		BUG(); /* Do not want to continue system boot .. */
+	}
 	memset(name, 0, 125);
 	moduleid = table;
 	current = file_contents;
@@ -252,6 +260,9 @@
 		ret_stuff.v0, (void *)ioconfig_file, (int)ioconfig_file_size);
 
 	ioconfig_bus_table = kmalloc( 512, GFP_KERNEL );
+	if (ioconfig_bus_table <= 0)
+		BUG(); /* Seriously, we should not be out of memory at init */
+
 	memset(ioconfig_bus_table, 0, 512);
 
 	/*
--- a/arch/ia64/sn/io/drivers/pciba.c	Thu Sep  4 14:38:03 2003
+++ b/arch/ia64/sn/io/drivers/pciba.c	Thu Sep  4 14:38:03 2003
@@ -341,8 +341,8 @@
 	TRACE();
 	
 	node = kmalloc(sizeof(struct node_data), GFP_KERNEL);
-	if (node == NULL)
-		return NULL;
+	if (node <= 0)
+		return node;
 	list_add(&node->global_node_list, &global_node_list);
 	return node;
 }
@@ -763,7 +763,7 @@
 
 		dma_alloc = (struct dma_allocation *)
 			kmalloc(sizeof(struct dma_allocation), GFP_KERNEL);
-		if (dma_alloc == NULL)
+		if (dma_alloc <= 0)
 			return -ENOMEM;
 
 		dma_alloc->size = (size_t)argv;

-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Thu Sep 4 15:15:01 2003

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:17 EST