From 45a3cb2be486414a6e2b17f5bb2e6fca7ba60f62 Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Mon, 15 Jun 2020 20:40:59 -0400 Subject: [PATCH] test/bdevio: add data length check for extended LBA format When the block size is 520(512 + 8) Bytes, we should check the data length before the tests. Change-Id: I785e395c9427460238205a52220e8333eee99ec0 Signed-off-by: Changpeng Liu Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2905 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Tomasz Zawadzki --- test/bdev/bdevio/bdevio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/test/bdev/bdevio/bdevio.c b/test/bdev/bdevio/bdevio.c index af2e16f76f..54d1712e34 100644 --- a/test/bdev/bdevio/bdevio.c +++ b/test/bdev/bdevio/bdevio.c @@ -419,6 +419,7 @@ static bool blockdev_io_valid_blocks(struct spdk_bdev *bdev, uint64_t data_length) { if (data_length < spdk_bdev_get_block_size(bdev) || + data_length % spdk_bdev_get_block_size(bdev) || data_length / spdk_bdev_get_block_size(bdev) > spdk_bdev_get_num_blocks(bdev)) { return false; }