From cc6aa917b973bd4382eb26c1b34c67f0da78a59d Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Sat, 26 Mar 2005 16:51:19 +0000 Subject: [PATCH] Check for return values. Submitted by: sam Found by: Coverity Prevent analysis tool --- sys/geom/mirror/g_mirror_ctl.c | 12 ++++++++++++ sys/geom/raid3/g_raid3_ctl.c | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/sys/geom/mirror/g_mirror_ctl.c b/sys/geom/mirror/g_mirror_ctl.c index fc3649d3793e..8dc87b69f8ad 100644 --- a/sys/geom/mirror/g_mirror_ctl.c +++ b/sys/geom/mirror/g_mirror_ctl.c @@ -96,11 +96,19 @@ g_mirror_ctl_configure(struct gctl_req *req, struct g_class *mp) g_topology_assert(); nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs)); + if (nargs == NULL) { + gctl_error(req, "No '%s' argument.", "nargs"); + return; + } if (*nargs != 1) { gctl_error(req, "Invalid number of arguments."); return; } name = gctl_get_asciiparam(req, "arg0"); + if (name == NULL) { + gctl_error(req, "No 'arg%u' argument.", 0); + return; + } sc = g_mirror_find_device(mp, name); if (sc == NULL) { gctl_error(req, "No such device: %s.", name); @@ -111,6 +119,10 @@ g_mirror_ctl_configure(struct gctl_req *req, struct g_class *mp) return; } balancep = gctl_get_asciiparam(req, "balance"); + if (balancep == NULL) { + gctl_error(req, "No '%s' argument.", "balance"); + return; + } if (strcmp(balancep, "none") == 0) balance = sc->sc_balance; else { diff --git a/sys/geom/raid3/g_raid3_ctl.c b/sys/geom/raid3/g_raid3_ctl.c index 8e36fddfede1..4ac04e0593a1 100644 --- a/sys/geom/raid3/g_raid3_ctl.c +++ b/sys/geom/raid3/g_raid3_ctl.c @@ -101,11 +101,19 @@ g_raid3_ctl_configure(struct gctl_req *req, struct g_class *mp) g_topology_assert(); nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs)); + if (nargs == NULL) { + gctl_error(req, "No '%s' argument.", "nargs"); + return; + } if (*nargs != 1) { gctl_error(req, "Invalid number of arguments."); return; } name = gctl_get_asciiparam(req, "arg0"); + if (name == NULL) { + gctl_error(req, "No 'arg%u' argument.", 0); + return; + } sc = g_raid3_find_device(mp, name); if (sc == NULL) { gctl_error(req, "No such device: %s.", name);