diff options
author | pjd <pjd@FreeBSD.org> | 2006-05-04 13:01:16 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2006-05-04 13:01:16 +0000 |
commit | 488dfb1ea0da7fa25f266b6fc42364da582c24d6 (patch) | |
tree | 36adb407777187ed0a3d0efb27ad119c0fd4a3a0 /sys/geom/raid3 | |
parent | 7192fe0c0ad30c2ab4f8da551446dd14bee6406e (diff) | |
download | FreeBSD-src-488dfb1ea0da7fa25f266b6fc42364da582c24d6.zip FreeBSD-src-488dfb1ea0da7fa25f266b6fc42364da582c24d6.tar.gz |
Use G_RAID3_FOREACH_SAFE_BIO() macro instead of G_RAID3_FOREACH_BIO() in
two places where g_io_request() is called. g_io_request() can free bio
structure so we can't reference it after and G_RAID3_FOREACH_BIO() macro
was doing this.
Found by: Coverity Prevent analysis tool (with my new models)
MFC after: 1 day
Diffstat (limited to 'sys/geom/raid3')
-rw-r--r-- | sys/geom/raid3/g_raid3.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/geom/raid3/g_raid3.c b/sys/geom/raid3/g_raid3.c index 04248b1..e184972 100644 --- a/sys/geom/raid3/g_raid3.c +++ b/sys/geom/raid3/g_raid3.c @@ -1009,7 +1009,7 @@ g_raid3_scatter(struct bio *pbp) { struct g_raid3_softc *sc; struct g_raid3_disk *disk; - struct bio *bp, *cbp; + struct bio *bp, *cbp, *tmpbp; off_t atom, cadd, padd, left; sc = pbp->bio_to->geom->softc; @@ -1038,8 +1038,6 @@ g_raid3_scatter(struct bio *pbp) cadd += atom; } if ((pbp->bio_pflags & G_RAID3_BIO_PFLAG_NOPARITY) == 0) { - struct bio *tmpbp; - /* * Calculate parity. */ @@ -1053,7 +1051,7 @@ g_raid3_scatter(struct bio *pbp) g_raid3_destroy_bio(sc, cbp); } } - G_RAID3_FOREACH_BIO(pbp, cbp) { + G_RAID3_FOREACH_SAFE_BIO(pbp, cbp, tmpbp) { struct g_consumer *cp; disk = cbp->bio_caller2; @@ -1685,7 +1683,7 @@ g_raid3_register_request(struct bio *pbp) struct g_raid3_softc *sc; struct g_raid3_disk *disk; struct g_consumer *cp; - struct bio *cbp; + struct bio *cbp, *tmpbp; off_t offset, length; u_int n, ndisks; int round_robin, verify; @@ -1831,7 +1829,7 @@ g_raid3_register_request(struct bio *pbp) */ sc->sc_round_robin = 0; } - G_RAID3_FOREACH_BIO(pbp, cbp) { + G_RAID3_FOREACH_SAFE_BIO(pbp, cbp, tmpbp) { disk = cbp->bio_caller2; cp = disk->d_consumer; cbp->bio_to = cp->provider; |