diff options
| author | Poul-Henning Kamp <phk@FreeBSD.org> | 2002-09-27 20:47:23 +0000 |
|---|---|---|
| committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2002-09-27 20:47:23 +0000 |
| commit | beece77a2d848939d980d77b129ff4a42d8d3213 (patch) | |
| tree | cbf3960b54abc9b9f5fe0f6e11921ee7275428b2 /sys | |
| parent | 346cd5fe2d5056b424b28a67687c8dcd87624aca (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/geom/geom_aes.c | 12 | ||||
| -rw-r--r-- | sys/geom/geom_slice.c | 7 |
2 files changed, 18 insertions, 1 deletions
diff --git a/sys/geom/geom_aes.c b/sys/geom/geom_aes.c index 70a8a85684bf4..4304c2d4f58ee 100644 --- a/sys/geom/geom_aes.c +++ b/sys/geom/geom_aes.c @@ -195,12 +195,20 @@ g_aes_start(struct bio *bp) switch (bp->bio_cmd) { case BIO_READ: bp2 = g_clone_bio(bp); + if (bp2 == NULL) { + g_io_fail(bp, ENOMEM); + return; + } bp2->bio_done = g_aes_read_done; bp2->bio_offset += sc->sectorsize; g_io_request(bp2, cp); break; case BIO_WRITE: bp2 = g_clone_bio(bp); + if (bp2 == NULL) { + g_io_fail(bp, ENOMEM); + return; + } bp2->bio_done = g_aes_write_done; bp2->bio_offset += sc->sectorsize; bp2->bio_data = g_malloc(bp->bio_length, M_WAITOK); @@ -226,6 +234,10 @@ g_aes_start(struct bio *bp) if (g_handleattr_int(bp, "GEOM::sectorsize", sc->sectorsize)) return; bp2 = g_clone_bio(bp); + if (bp2 == NULL) { + g_io_fail(bp, ENOMEM); + return; + } bp2->bio_done = g_std_done; bp2->bio_offset += sc->sectorsize; g_io_request(bp2, cp); diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c index ab781d5c40605..5bd20ea155243 100644 --- a/sys/geom/geom_slice.c +++ b/sys/geom/geom_slice.c @@ -72,7 +72,8 @@ g_slice_init(unsigned nslice, unsigned scsize) gsp = g_malloc(sizeof *gsp, M_WAITOK | M_ZERO); gsp->softc = g_malloc(scsize, M_WAITOK | M_ZERO); - gsp->slices = g_malloc(nslice * sizeof(struct g_slice), M_WAITOK | M_ZERO); + gsp->slices = g_malloc(nslice * sizeof(struct g_slice), + M_WAITOK | M_ZERO); gsp->nslice = nslice; return (gsp); } @@ -148,6 +149,10 @@ g_slice_start(struct bio *bp) return; } bp2 = g_clone_bio(bp); + if (bp2 == NULL) { + g_io_fail(bp, ENOMEM); + return; + } if (bp2->bio_offset + bp2->bio_length > gsl->length) bp2->bio_length = gsl->length - bp2->bio_offset; bp2->bio_done = g_std_done; |
