public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* i2o: CONFIG_DEBUG_SG compilation fixed
@ 2007-10-29  6:32 Vasily Averin
  2007-10-29  8:58 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Vasily Averin @ 2007-10-29  6:32 UTC (permalink / raw)
  To: Linux Kernel Mailing List, devel; +Cc: Jens Axboe, Andrew Morton

i2o crashed when CONFIG_DEBUG_SG is enabled because i2o_block_request structure
includes array of scatterlists that should be initialised

Signed-off-by:	Vasily Averin <vvs@sw.ru>
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -1137,6 +1137,18 @@ static struct i2o_driver i2o_block_driver = {
  *
  *	Returns 0 on success or negative error code on failure.
  */
+
+#ifdef CONFIG_DEBUG_SG
+static void i2o_block_req_ctor(struct kmem_cache *cachep, void *objp) {
+	sg_init_table(((struct i2o_block_request *)(objp))->sg_table,
+						 I2O_MAX_PHYS_SEGMENTS);
+}
+
+#define I2O_BLK_CTOR	&i2o_block_req_ctor
+#else
+#define I2O_BLK_CTOR	NULL
+#endif
+
 static int __init i2o_block_init(void)
 {
 	int rc;
@@ -1147,7 +1159,7 @@ static int __init i2o_block_init(void)
 	/* Allocate request mempool and slab */
 	size = sizeof(struct i2o_block_request);
 	i2o_blk_req_pool.slab = kmem_cache_create("i2o_block_req", size, 0,
-						  SLAB_HWCACHE_ALIGN, NULL);
+					  SLAB_HWCACHE_ALIGN, I2O_BLK_CTOR);
 	if (!i2o_blk_req_pool.slab) {
 		osm_err("can't init request slab\n");
 		rc = -ENOMEM;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-10-29  9:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-29  6:32 i2o: CONFIG_DEBUG_SG compilation fixed Vasily Averin
2007-10-29  8:58 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox