Skip to contentSkip to conversation

Don't blatt first element of prv in sg_chain()

PATCH In review Rusty Russell 3 participants 3 messages Jan 7, 2008 – Jan 11, 2008 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Don't blatt first element of prv in sg_chain()

I realize that sg chaining is a ploy to make the rest of the kernel devs feel the pain of the SCSI subsystem. But this was a little unsubtle.

include/linux/scatterlist.h +2 -2
diff -r b3aec596b841 include/linux/scatterlist.h
@@ -188,8 +188,8 @@ static inline void sg_chain(struct scatt
 	/*
 	 * offset and length are unused for chain entry.  Clear them.
 	 */
-	prv->offset = 0;
-	prv->length = 0;
+	prv[prv_nents - 1].offset = 0;
+	prv[prv_nents - 1].length = 0;
 
 	/*
 	 * Set lowest bit to indicate a link pointer, and make sure to clear
#1 lore raw
Quoted 5 lines · Rusty Russell

I realize that sg chaining is a ploy to make the rest of the kernel devs feel the pain of the SCSI subsystem. But this was a little unsubtle.

Embarrassingly Acked-by: Tejun Heo <[email protected]>

Thanks.

Signature · 1 line
tejun
#2 lore raw
In reply to Rusty Russell
Quoted 10 lines · Rusty Russell

I realize that sg chaining is a ploy to make the rest of the kernel devs feel the pain of the SCSI subsystem. But this was a little unsubtle.

diff -r b3aec596b841 include/linux/scatterlist.h

include/linux/scatterlist.h static inline void sg_chain(struct scatt · line 195

Quoted 10 lines
include/linux/scatterlist.h +2 -2
@@ -188,8 +188,8 @@ static inline void sg_chain(struct scatt
 	/*
 	 * offset and length are unused for chain entry.  Clear them.
 	 */
-	prv->offset = 0;
-	prv->length = 0;
+	prv[prv_nents - 1].offset = 0;
+	prv[prv_nents - 1].length = 0;
 
 	/*
 	 * Set lowest bit to indicate a link pointer, and make sure to clear

Dang, I should have caught that. Thanks Rusty...

Signature · 1 line
Jens Axboe