bdev: assert against bdev_io buffer overflow

Also updated docs.

Change-Id: I2e53c31b2c9c575d8adea23ed92f113e69f324ed
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/380490
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-09-27 20:59:50 +02:00 committed by Jim Harris
parent b5c0a51ec7
commit 04124278b9
2 changed files with 4 additions and 1 deletions

View File

@ -380,7 +380,9 @@ void spdk_bdev_poller_stop(struct spdk_bdev_poller **ppoller);
* \param bdev_io I/O to allocate buffer for.
* \param cb callback to be called when the buffer is allocated
* or the bdev_io has an SGL assigned already.
* \param len size of the buffer to allocate.
* \param len size of the buffer to allocate. In case the bdev_io
* doesn't have an SGL assigned this field must be no bigger than
* \c SPDK_BDEV_LARGE_BUF_MAX_SIZE.
*/
void spdk_bdev_io_get_buf(struct spdk_bdev_io *bdev_io, spdk_bdev_io_get_buf_cb cb, uint64_t len);

View File

@ -282,6 +282,7 @@ spdk_bdev_io_get_buf(struct spdk_bdev_io *bdev_io, spdk_bdev_io_get_buf_cb cb, u
return;
}
assert(len <= SPDK_BDEV_LARGE_BUF_MAX_SIZE);
ch = spdk_io_channel_get_ctx(bdev_io->ch->mgmt_channel);
bdev_io->buf_len = len;