aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorDon Brady <[email protected]>2018-02-20 12:19:42 -0700
committerBrian Behlendorf <[email protected]>2018-02-20 11:19:42 -0800
commitcbce58135341d470c3a57e343bebe253384e1198 (patch)
treecf52686aa6a4fd1d75845506618870edf61a249d /module/zfs
parent7b30ee6bafe91ebd3b34433ef3b943fd07a98cea (diff)
Fix coverity defects: zfs channel programs
CID 173243, 173245: Memory - corruptions (OVERRUN) Added size argument to lcompat_sprintf() to avoid use of INT_MAX CID 173244: Integer handling issues (OVERFLOW_BEFORE_WIDEN) Added cast to uint64_t to avoid a 32 bit overflow warning CID 173242: Integer handling issues (CONSTANT_EXPRESSION_RESULT) Conditionally removed unused luai_numisnan() floating point check CID 173241: Resource leaks (RESOURCE_LEAK) Added missing close(fd) on error path CID 173240: (UNINIT) Fixed uninitialized variable in get_special_prop() CID 147560: Null pointer dereferences (NULL_RETURNS) Cleaned up bad code merge in dsl_dataset_promote_check() CID 28475: Memory - illegal accesses (OVERRUN) Fixed lcompat_sprintf() to use a size paramater CID 28418, 28422: Error handling issues (CHECKED_RETURN) Added function result cast to (void) to avoid warning CID 23935, 28411, 28412: Memory - corruptions (ARRAY_VS_SINGLETON) Added casts to avoid exposing result as an array Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Don Brady <[email protected]> Closes #7181
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/dsl_dataset.c5
-rw-r--r--module/zfs/zcp_get.c2
-rw-r--r--module/zfs/zcp_synctask.c3
3 files changed, 4 insertions, 6 deletions
diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c
index 86f088889..40c2df1e7 100644
--- a/module/zfs/dsl_dataset.c
+++ b/module/zfs/dsl_dataset.c
@@ -2750,12 +2750,8 @@ dsl_dataset_promote_check(void *arg, dmu_tx_t *tx)
return (err);
hds = ddpa->ddpa_clone;
- snap = list_head(&ddpa->shared_snaps);
- origin_ds = snap->ds;
max_snap_len = MAXNAMELEN - strlen(ddpa->ddpa_clonename) - 1;
- snap = list_head(&ddpa->origin_snaps);
-
if (dsl_dataset_phys(hds)->ds_flags & DS_FLAG_NOPROMOTE) {
promote_rele(ddpa, FTAG);
return (SET_ERROR(EXDEV));
@@ -2789,6 +2785,7 @@ dsl_dataset_promote_check(void *arg, dmu_tx_t *tx)
/* compute origin's new unique space */
snap = list_tail(&ddpa->clone_snaps);
+ ASSERT(snap != NULL);
ASSERT3U(dsl_dataset_phys(snap->ds)->ds_prev_snap_obj, ==,
origin_ds->ds_object);
dsl_deadlist_space_range(&snap->ds->ds_deadlist,
diff --git a/module/zfs/zcp_get.c b/module/zfs/zcp_get.c
index 7645bc158..2481bb1fe 100644
--- a/module/zfs/zcp_get.c
+++ b/module/zfs/zcp_get.c
@@ -303,7 +303,7 @@ get_special_prop(lua_State *state, dsl_dataset_t *ds, const char *dsname,
{
int error = 0;
objset_t *os;
- uint64_t numval;
+ uint64_t numval = 0;
char *strval = kmem_alloc(ZAP_MAXVALUELEN, KM_SLEEP);
char setpoint[ZFS_MAX_DATASET_NAME_LEN] =
"Internal error - setpoint not determined";
diff --git a/module/zfs/zcp_synctask.c b/module/zfs/zcp_synctask.c
index 5a7066407..196a3d4b7 100644
--- a/module/zfs/zcp_synctask.c
+++ b/module/zfs/zcp_synctask.c
@@ -297,7 +297,8 @@ zcp_synctask_wrapper(lua_State *state)
dsl_pool_t *dp = ri->zri_pool;
/* MOS space is triple-dittoed, so we multiply by 3. */
- uint64_t funcspace = (info->blocks_modified << DST_AVG_BLKSHIFT) * 3;
+ uint64_t funcspace =
+ ((uint64_t)info->blocks_modified << DST_AVG_BLKSHIFT) * 3;
zcp_parse_args(state, info->name, info->pargs, info->kwargs);