Thomas Moschny wrote:
On Wednesday 16 November 2005 02:04, Doug Ledford wrote:

I have initial RPM support for both of these releases available for
use/testing.


Thanks for providing the rpms!

If you try these out and have any problems, please email me directly
(and feel free to Cc: the list) for more immediate responses.


Unfortunately, we got an kernel-oops on ia64 (rhel4) ...
The boot log is attached.

- Thomas

I think I know what this is. On any arch where sizeof(int) != sizeof(void *) the kernel version on my site would oops. The kernel you tested was one where I was in the process of adding kzalloc() to slab.c so that driver backports would be a bit less painful in the future. However, I missed adding the function prototype to the include files. This resulted in a lot of "assignment makes pointer from integer without a cast" errors anywhere kzalloc was used. Well, on 64bit arches, you can't make a full pointer from an integer. So, I'm thinking that the oops is the result of a partial conversion from a 32bit int to a 64bit pointer, even though kzalloc actually returned a 64bit pointer anyway. The attached patch should be able to be dropped into the existing srpm in place of the patch with the same name and a rebuild should then solve the problem, although in the process of creating this patch I had to move it from the 2700 section of the patch list down to the 10002 position because it touches things added after the infiniband code.


--
Doug Ledford <[EMAIL PROTECTED]>
http://people.redhat.com/dledford

--- linux-2.6.9/include/linux/slab.h.strdup	2005-11-16 16:36:22.000000000 -0500
+++ linux-2.6.9/include/linux/slab.h	2005-11-16 20:46:19.000000000 -0500
@@ -98,6 +98,8 @@
 	return __kmalloc(size, flags);
 }
 
+extern void *kzalloc(size_t, int);
+
 extern void *kcalloc(size_t, size_t, int);
 extern void kfree(const void *);
 extern unsigned int ksize(const void *);
--- linux-2.6.9/include/linux/string.h.strdup	2005-11-16 16:38:44.000000000 -0500
+++ linux-2.6.9/include/linux/string.h	2005-11-16 20:45:31.000000000 -0500
@@ -88,6 +88,8 @@
 extern void * memchr(const void *,int,__kernel_size_t);
 #endif
 
+extern char *kstrdup(const char *s, int gfp);
+
 #ifdef __cplusplus
 }
 #endif
--- linux-2.6.9/drivers/md/dm-ioctl.c.strdup	2005-11-16 17:46:23.000000000 -0500
+++ linux-2.6.9/drivers/md/dm-ioctl.c	2005-11-16 17:47:33.000000000 -0500
@@ -122,14 +122,6 @@
 /*-----------------------------------------------------------------
  * Inserting, removing and renaming a device.
  *---------------------------------------------------------------*/
-static inline char *kstrdup(const char *str)
-{
-	char *r = kmalloc(strlen(str) + 1, GFP_KERNEL);
-	if (r)
-		strcpy(r, str);
-	return r;
-}
-
 static struct hash_cell *alloc_cell(const char *name, const char *uuid,
 				    struct mapped_device *md)
 {
@@ -139,7 +131,7 @@
 	if (!hc)
 		return NULL;
 
-	hc->name = kstrdup(name);
+	hc->name = kstrdup(name, GFP_KERNEL);
 	if (!hc->name) {
 		kfree(hc);
 		return NULL;
@@ -149,7 +141,7 @@
 		hc->uuid = NULL;
 
 	else {
-		hc->uuid = kstrdup(uuid);
+		hc->uuid = kstrdup(uuid, GFP_KERNEL);
 		if (!hc->uuid) {
 			kfree(hc->name);
 			kfree(hc);
@@ -282,7 +274,7 @@
 	/*
 	 * duplicate new.
 	 */
-	new_name = kstrdup(new);
+	new_name = kstrdup(new, GFP_KERNEL);
 	if (!new_name)
 		return -ENOMEM;
 
--- linux-2.6.9/mm/slab.c.strdup	2005-11-14 21:31:21.000000000 -0500
+++ linux-2.6.9/mm/slab.c	2005-11-16 20:46:04.000000000 -0500
@@ -2507,6 +2507,20 @@
 EXPORT_SYMBOL(kmem_cache_free);
 
 /**
+ * kzalloc - allocate memory. The memory is set to zero.
+ * @size: how many bytes of memory are required.
+ * @flags: the type of memory to allocate.
+ */
+void *kzalloc(size_t size, int flags)
+{
+	void *ret = kmalloc(size, flags);
+	if (ret)
+		memset(ret, 0, size);
+	return ret;
+}
+EXPORT_SYMBOL(kzalloc);
+
+/**
  * kcalloc - allocate memory for an array. The memory is set to zero.
  * @n: number of elements.
  * @size: element size.
@@ -3033,3 +3047,25 @@
 
 	return size;
 }
+
+/*
+ * kstrdup - allocate space for and copy an existing string
+ *
+ * @s: the string to duplicate
+ * @gfp: the GFP mask used in the kmalloc() call when allocating memory
+ */
+char *kstrdup(const char *s, int gfp)
+{
+	size_t len;
+	char *buf;
+
+	if (!s)
+		return NULL;
+
+	len = strlen(s) + 1;
+	buf = kmalloc(len, gfp);
+	if (buf)
+		memcpy(buf, s, len);
+	return buf;
+}
+EXPORT_SYMBOL(kstrdup);
--- linux-2.6.9/sound/pci/azx/patch_realtek.c.strdup	2005-11-16 21:31:36.000000000 -0500
+++ linux-2.6.9/sound/pci/azx/patch_realtek.c	2005-11-16 21:32:13.000000000 -0500
@@ -30,29 +30,6 @@
 #include "hda_codec.h"
 #include "hda_local.h"
 
-/* RHEL4 compat */
-/*
- * kstrdup - allocate space for and copy an existing string
- *
- * @s: the string to duplicate
- * @gfp: the GFP mask used in the kmalloc() call when allocating memory
- */
-static char *kstrdup(const char *s, unsigned int gfp)
-{
-	size_t len;
-	char *buf;
-
-	if (!s)
-		return NULL;
-
-	len = strlen(s) + 1;
-	buf = kmalloc(len, gfp);
-	if (buf)
-		memcpy(buf, s, len);
-	return buf;
-}
-
-
 /* ALC880 board config type */
 enum {
 	ALC880_3ST,
_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to