bdev/malloc: check block size when creating a new block device
Fix #1808 Change-Id: Iee2ca197ecfd096ffda9ea067bd13f8995792ff3 Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6578 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: <dongx.yi@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
3d9e67b07d
commit
b5fe146a9c
@ -387,6 +387,11 @@ create_malloc_disk(struct spdk_bdev **bdev, const char *name, const struct spdk_
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (block_size % 512) {
|
||||
SPDK_ERRLOG("block size must be 512 bytes aligned\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mdisk = calloc(1, sizeof(*mdisk));
|
||||
if (!mdisk) {
|
||||
SPDK_ERRLOG("mdisk calloc() failed\n");
|
||||
|
Loading…
Reference in New Issue
Block a user