mirror of
https://github.com/torvalds/linux.git
synced 2024-12-28 13:51:44 +00:00
dax: guarantee page aligned results from bdev_direct_access()
If a ->direct_access() implementation ever returns a map count less than PAGE_SIZE, catch the error in bdev_direct_access(). This simplifies error checking in upper layers. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Reported-by: Ross Zwisler <ross.zwisler@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
0e749e5424
commit
fe683adabf
@ -494,6 +494,8 @@ long bdev_direct_access(struct block_device *bdev, sector_t sector,
|
||||
avail = ops->direct_access(bdev, sector, addr, pfn);
|
||||
if (!avail)
|
||||
return -ERANGE;
|
||||
if (avail > 0 && avail & ~PAGE_MASK)
|
||||
return -ENXIO;
|
||||
return min(avail, size);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(bdev_direct_access);
|
||||
|
Loading…
Reference in New Issue
Block a user