Skip to contentSkip to conversation

bug waiting to happen in rq_for_each_bio

PATCH In review Xavier Bestel 2 participants 2 messages Jan 15, 2004 – Jan 16, 2004 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bug waiting to happen in rq_for_each_bio

This bug would have been caught at compile time anyway, unless somebody uses a weird name for bio.

include/linux/blkdev.h 2004-01-15 22:44:23.000000000 +0100 renamed from include/linux/blkdev.h.orig 2004-01-15 22:43:29.000000000 +0100 +2 -2
@@ -493,9 +493,9 @@
 }
 #endif /* CONFIG_MMU */
  
-#define rq_for_each_bio(bio, rq)       \
+#define rq_for_each_bio(_bio, rq)      \
        if ((rq->bio))                  \
-               for (bio = (rq)->bio; bio; bio = bio->bi_next)
+               for (_bio = (rq)->bio; _bio; _bio = _bio->bi_next)
  
 struct sec_size {
        unsigned block_size;
#1 lore raw
Quoted 7 lines · Xavier Bestel

This bug would have been caught at compile time anyway, unless somebody uses a weird name for bio.

include/linux/blkdev.h 2004-01-15 22:44:23.000000000 +0100 renamed from include/linux/blkdev.h.orig 2004-01-15 22:43:29.000000000 +0100 +0 -0
@@ -493,9 +493,9 @@
 }

include/linux/blkdev.h 2004-01-15 22:44:23.000000000 +0100 line 501

Quoted 10 lines
include/linux/blkdev.h 2004-01-15 22:44:23.000000000 +0100 renamed from include/linux/blkdev.h.orig 2004-01-15 22:43:29.000000000 +0100 +2 -2
 #endif /* CONFIG_MMU */
 
-#define rq_for_each_bio(bio, rq)       \
+#define rq_for_each_bio(_bio, rq)      \
        if ((rq->bio))                  \
-               for (bio = (rq)->bio; bio; bio = bio->bi_next)
+               for (_bio = (rq)->bio; _bio; _bio = _bio->bi_next)
 
 struct sec_size {
        unsigned block_size;

Yep, should be added. Thanks.

Signature · 1 line
Jens Axboe