Block layer caching can't work if a block is bigger than BUFSIZE which is used for the caching chunks. Instead of ending up with a rdbufsize of 0, which leads to strange errors on device access, just refuse this outright. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- common/block.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/block.c b/common/block.c index 7f28b56419e2..c39269d3a692 100644 --- a/common/block.c +++ b/common/block.c @@ -388,6 +388,11 @@ int blockdevice_register(struct block_device *blk) dev_dbg(blk->dev, "rdbufsize: %d blockbits: %d blkmask: 0x%08x\n", blk->rdbufsize, blk->blockbits, blk->blkmask); + if (!blk->rdbufsize) { + pr_warn("block size of %u not supported\n", BLOCKSIZE(blk)); + return -ENOSYS; + } + for (i = 0; i < 8; i++) { struct chunk *chunk = xzalloc(sizeof(*chunk)); chunk->data = dma_alloc(BUFSIZE); -- 2.39.2