Author: lulf Date: Tue Nov 25 20:28:33 2008 New Revision: 185318 URL: http://svn.freebsd.org/changeset/base/185318
Log: - Fix a potential NULL pointer reference. Note that this should not happen in practice, but it is a good programming practice and allows the kernel to not depend on userland correctness. - While there, make sizeof usage match the rest of the code. Found with: Coverity Prevent(tm) CID: 660, 662 Modified: head/sys/geom/geom_ccd.c Modified: head/sys/geom/geom_ccd.c ============================================================================== --- head/sys/geom/geom_ccd.c Tue Nov 25 20:02:47 2008 (r185317) +++ head/sys/geom/geom_ccd.c Tue Nov 25 20:28:33 2008 (r185318) @@ -709,8 +709,20 @@ g_ccd_create(struct gctl_req *req, struc g_topology_assert(); unit = gctl_get_paraml(req, "unit", sizeof (*unit)); + if (unit == NULL) { + gctl_error(req, "unit parameter not given"); + return; + } ileave = gctl_get_paraml(req, "ileave", sizeof (*ileave)); + if (ileave == NULL) { + gctl_error(req, "ileave parameter not given"); + return; + } nprovider = gctl_get_paraml(req, "nprovider", sizeof (*nprovider)); + if (nprovider == NULL) { + gctl_error(req, "nprovider parameter not given"); + return; + } /* Check for duplicate unit */ LIST_FOREACH(gp, &mp->geom, geom) { @@ -838,7 +850,11 @@ g_ccd_list(struct gctl_req *req, struct struct g_geom *gp; int i, unit, *up; - up = gctl_get_paraml(req, "unit", sizeof (int)); + up = gctl_get_paraml(req, "unit", sizeof (*up)); + if (up == NULL) { + gctl_error(req, "unit parameter not given"); + return; + } unit = *up; sb = sbuf_new_auto(); LIST_FOREACH(gp, &mp->geom, geom) { _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "[EMAIL PROTECTED]"