[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |