Skip to contentSkip to conversation

Initialise scatter/gather list in sg driver

PATCH Applied Anton Blanchard 2 participants 2 messages Oct 25, 2007 – Oct 26, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Initialise scatter/gather list in sg driver

After turning on DEBUG_SG I hit a fail:

kernel BUG at include/linux/scatterlist.h:50!

sg_build_indirect
sg_build_reserve
sg_open
chrdev_open
__dentry_open
do_filp_open
do_sys_open

We should initialise the sg list when we allocate it in sg_build_sgat.

---

drivers/scsi/sg.c +1 -0
index b5fa4f0..f1871ea 100644
@@ -1652,6 +1652,7 @@ sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize)
 	schp->buffer = kzalloc(sg_bufflen, gfp_flags);
 	if (!schp->buffer)
 		return -ENOMEM;
+	sg_init_table(schp->buffer, tablesize);
 	schp->sglist_len = sg_bufflen;
 	return tablesize;	/* number of scat_gath elements allocated */
 }
Applied
#1 lore raw
Quoted 23 lines · Anton Blanchard

After turning on DEBUG_SG I hit a fail:

kernel BUG at include/linux/scatterlist.h:50!

sg_build_indirect
sg_build_reserve
sg_open
chrdev_open
__dentry_open
do_filp_open
do_sys_open

We should initialise the sg list when we allocate it in sg_build_sgat.

---

drivers/scsi/sg.c +0 -0
index b5fa4f0..f1871ea 100644

drivers/scsi/sg.c sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize) · line 1658

Quoted 7 lines
drivers/scsi/sg.c +1 -0
@@ -1652,6 +1652,7 @@ sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize)
 	schp->buffer = kzalloc(sg_bufflen, gfp_flags);
 	if (!schp->buffer)
 		return -ENOMEM;
+	sg_init_table(schp->buffer, tablesize);
 	schp->sglist_len = sg_bufflen;
 	return tablesize;	/* number of scat_gath elements allocated */
 }

Thanks, applied!

Signature · 1 line
Jens Axboe