|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] [PATCH 09/10] blktap: device_info validation fixes.
- Logical block size <= 4k is too paranoid.
- Use ilog2 and add more comments.
---
drivers/block/blktap/device.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/block/blktap/device.c b/drivers/block/blktap/device.c
index 0e8eb0a..2379643 100644
--- a/drivers/block/blktap/device.c
+++ b/drivers/block/blktap/device.c
@@ -315,12 +315,13 @@ blktap_device_validate_info(struct blktap *tap,
unsigned int phys_mask;
int sector_order;
- sector_order = ffs(info->sector_size) - 1;
+ /* sector size is is 2^(n >= 9) */
+ sector_order = ilog2(info->sector_size);
if (sector_order < 9 ||
- sector_order > 12 ||
info->sector_size != 1U<<sector_order)
goto fail;
+ /* make sure capacity doesn't overflow */
if (!info->capacity ||
(info->capacity > ULLONG_MAX >> sector_order))
goto fail;
--
1.7.0.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-devel] [PATCH 01/10] blktap: Add include/linux/blktap.h, (continued)
- [Xen-devel] [PATCH 02/10] blktap: Upgrade CREATE_DEVICE ioctl., Daniel Stodden
- [Xen-devel] [PATCH 04/10] blktap: Fix reference to freed struct request., Daniel Stodden
- [Xen-devel] [PATCH 05/10] blktap: Support non-R/W requests, Daniel Stodden
- [Xen-devel] [PATCH 06/10] blktap: Drop the ring message timestamp., Daniel Stodden
- [Xen-devel] [PATCH 07/10] blktap: Avoid some header quirks., Daniel Stodden
- [Xen-devel] [PATCH 08/10] blktap: Set up physical sector size and alignment offsets., Daniel Stodden
- [Xen-devel] [PATCH 09/10] blktap: device_info validation fixes.,
Daniel Stodden <=
- [Xen-devel] [PATCH 10/10] blktap: Add BLKTAP_OP_FLUSH command option., Daniel Stodden
- [Xen-devel] [PATCH 03/10] blktap: Move from drivers/xen to drivers/block, Daniel Stodden
- [Xen-devel] [PATCH] blktap: Move from drivers/xen to drivers/block, Daniel Stodden
Re: [Xen-devel] blktap2 updates, Daniel Stodden
|
|
|
|
|