Fix reading uninitialized variable in receive_read
When zfs_file_read returns error, resid may be uninitialized. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Signed-off-by: Chunwei Chen <david.chen@nutanix.com> Closes #14404
This commit is contained in:
parent
63267f7f77
commit
71974946be
@ -1500,11 +1500,11 @@ receive_read(dmu_recv_cookie_t *drc, int len, void *buf)
|
||||
(drc->drc_featureflags & DMU_BACKUP_FEATURE_RAW) != 0);
|
||||
|
||||
while (done < len) {
|
||||
ssize_t resid;
|
||||
ssize_t resid = len - done;
|
||||
zfs_file_t *fp = drc->drc_fp;
|
||||
int err = zfs_file_read(fp, (char *)buf + done,
|
||||
len - done, &resid);
|
||||
if (resid == len - done) {
|
||||
if (err == 0 && resid == len - done) {
|
||||
/*
|
||||
* Note: ECKSUM or ZFS_ERR_STREAM_TRUNCATED indicates
|
||||
* that the receive was interrupted and can
|
||||
|
Loading…
Reference in New Issue
Block a user