diff --git a/include/spdk_internal/bdev.h b/include/spdk_internal/bdev.h index b95c82949..899c5bffa 100644 --- a/include/spdk_internal/bdev.h +++ b/include/spdk_internal/bdev.h @@ -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); diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index eec49c7e5..8870ced68 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -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;