blob: Make sure that our IOVs match the io size

This is in response to a Scan-build error with Clang 6.0 but is a real
bug. If we don't match up our IOVs properly with the lenght we provide,
we could jump over the iov list into invalid memory in
_spdk_rw_iov_split_next.

Change-Id: I472a7aa53027af0a18ebeee8226e0b008447cce4
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/424248
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Seth Howell 2018-08-31 08:39:04 -07:00 committed by Jim Harris
parent 938183c94d
commit 4b1c2e5f48

View File

@ -2023,6 +2023,7 @@ _spdk_rw_iov_split_next(void *cb_arg, int bserrno)
iov = &ctx->iov[0];
iovcnt = 0;
while (byte_count > 0) {
assert(iovcnt < ctx->iovcnt);
iov->iov_len = spdk_min(byte_count, orig_iov->iov_len - orig_iovoff);
iov->iov_base = orig_iov->iov_base + orig_iovoff;
byte_count -= iov->iov_len;