aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2004-06-24 10:50:20 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2004-06-24 10:50:20 +0000
commit40f798dad11104c5305bfc3beffb711747afc764 (patch)
tree9a50f9a8a2544a3bdbd752c6294e61ec050530ad
parent075ef102342fbdbdc77e1cd347b8c91c09380315 (diff)
Notes
-rw-r--r--sys/geom/geom_slice.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c
index 8a769105319f5..95312c0626cfc 100644
--- a/sys/geom/geom_slice.c
+++ b/sys/geom/geom_slice.c
@@ -62,7 +62,10 @@ g_slice_alloc(unsigned nslice, unsigned scsize)
struct g_slicer *gsp;
gsp = g_malloc(sizeof *gsp, M_WAITOK | M_ZERO);
- gsp->softc = g_malloc(scsize, M_WAITOK | M_ZERO);
+ if (scsize > 0)
+ gsp->softc = g_malloc(scsize, M_WAITOK | M_ZERO);
+ else
+ gsp->softc = NULL;
gsp->slices = g_malloc(nslice * sizeof(struct g_slice),
M_WAITOK | M_ZERO);
gsp->nslice = nslice;
@@ -468,7 +471,8 @@ g_slice_new(struct g_class *mp, u_int slices, struct g_provider *pp, struct g_co
g_wither_geom(gp, ENXIO);
return (NULL);
}
- *vp = gsp->softc;
+ if (extrap != NULL)
+ *vp = gsp->softc;
*cpp = cp;
return (gp);
}