Fix coverity defects: CID 147488, 147490
CID 147488, Type:explicit null dereferenced CID 147490, Type:dereference null return value Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: cao.xuewen <cao.xuewen@zte.com.cn> Closes #5237
This commit is contained in:
parent
3691598e26
commit
b6ca6193f7
|
@ -1585,6 +1585,7 @@ zprop_parse_value(libzfs_handle_t *hdl, nvpair_t *elem, int prop,
|
||||||
const char *propname;
|
const char *propname;
|
||||||
char *value;
|
char *value;
|
||||||
boolean_t isnone = B_FALSE;
|
boolean_t isnone = B_FALSE;
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
if (type == ZFS_TYPE_POOL) {
|
if (type == ZFS_TYPE_POOL) {
|
||||||
proptype = zpool_prop_get_type(prop);
|
proptype = zpool_prop_get_type(prop);
|
||||||
|
@ -1607,7 +1608,12 @@ zprop_parse_value(libzfs_handle_t *hdl, nvpair_t *elem, int prop,
|
||||||
"'%s' must be a string"), nvpair_name(elem));
|
"'%s' must be a string"), nvpair_name(elem));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
(void) nvpair_value_string(elem, svalp);
|
err = nvpair_value_string(elem, svalp);
|
||||||
|
if (err != 0) {
|
||||||
|
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||||
|
"'%s' is invalid"), nvpair_name(elem));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
if (strlen(*svalp) >= ZFS_MAXPROPLEN) {
|
if (strlen(*svalp) >= ZFS_MAXPROPLEN) {
|
||||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||||
"'%s' is too long"), nvpair_name(elem));
|
"'%s' is too long"), nvpair_name(elem));
|
||||||
|
|
|
@ -4947,7 +4947,7 @@ spa_vdev_detach(spa_t *spa, uint64_t guid, uint64_t pguid, int replace_done)
|
||||||
* But first make sure we're not on any *other* txg's DTL list, to
|
* But first make sure we're not on any *other* txg's DTL list, to
|
||||||
* prevent vd from being accessed after it's freed.
|
* prevent vd from being accessed after it's freed.
|
||||||
*/
|
*/
|
||||||
vdpath = spa_strdup(vd->vdev_path);
|
vdpath = spa_strdup(vd->vdev_path ? vd->vdev_path : "none");
|
||||||
for (t = 0; t < TXG_SIZE; t++)
|
for (t = 0; t < TXG_SIZE; t++)
|
||||||
(void) txg_list_remove_this(&tvd->vdev_dtl_list, vd, t);
|
(void) txg_list_remove_this(&tvd->vdev_dtl_list, vd, t);
|
||||||
vd->vdev_detached = B_TRUE;
|
vd->vdev_detached = B_TRUE;
|
||||||
|
|
Loading…
Reference in New Issue