diff options
author | pjd <pjd@FreeBSD.org> | 2006-11-02 09:14:18 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2006-11-02 09:14:18 +0000 |
commit | ba0f34826195f7102bbec2980b74c9d923b0228f (patch) | |
tree | c5c91436663960f6fd1dddb1fe860741b5564111 /sys/geom | |
parent | 9fbd00e8784f3967cf0d1e83c5aafe9b6d450211 (diff) | |
download | FreeBSD-src-ba0f34826195f7102bbec2980b74c9d923b0228f.zip FreeBSD-src-ba0f34826195f7102bbec2980b74c9d923b0228f.tar.gz |
- Use g_duplicate_bio() instead of g_clone_bio(), so there memory is
allocated with M_WAITOK flag.
- Check 'buf' instead of 'error' so Prevent is not confused.
CID: 1562, 1563
Found by: Coverity Prevent analysis tool
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/journal/g_journal.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/geom/journal/g_journal.c b/sys/geom/journal/g_journal.c index ad16e78..93293f9 100644 --- a/sys/geom/journal/g_journal.c +++ b/sys/geom/journal/g_journal.c @@ -600,11 +600,9 @@ g_journal_metadata_read(struct g_consumer *cp, struct g_journal_metadata *md) &error); g_topology_lock(); g_access(cp, -1, 0, 0); - if (error != 0) { + if (buf == NULL) { GJ_DEBUG(1, "Cannot read metadata from %s (error=%d).", cp->provider->name, error); - if (buf != NULL) - g_free(buf); return (error); } @@ -1622,7 +1620,7 @@ g_journal_read(struct g_journal_softc *sc, struct bio *pbp, off_t ostart, } if (bp != NULL) { if (bp->bio_data == NULL) { - nbp = g_clone_bio(pbp); + nbp = g_duplicate_bio(pbp); nbp->bio_cflags = GJ_BIO_READ; nbp->bio_data = pbp->bio_data + cstart - pbp->bio_offset; @@ -1646,7 +1644,7 @@ g_journal_read(struct g_journal_softc *sc, struct bio *pbp, off_t ostart, * Its time for asking data provider. */ GJ_DEBUG(3, "READ(data): (%jd, %jd)", ostart, oend); - nbp = g_clone_bio(pbp); + nbp = g_duplicate_bio(pbp); nbp->bio_cflags = GJ_BIO_READ; nbp->bio_data = pbp->bio_data + ostart - pbp->bio_offset; nbp->bio_offset = ostart; |