diff options
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r-- | fs/block_dev.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index f02b7bdd9864..742899240872 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/mount.h> | 22 | #include <linux/mount.h> |
23 | #include <linux/uio.h> | 23 | #include <linux/uio.h> |
24 | #include <linux/namei.h> | 24 | #include <linux/namei.h> |
25 | #include <linux/log2.h> | ||
25 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
26 | #include "internal.h" | 27 | #include "internal.h" |
27 | 28 | ||
@@ -67,7 +68,7 @@ static void kill_bdev(struct block_device *bdev) | |||
67 | int set_blocksize(struct block_device *bdev, int size) | 68 | int set_blocksize(struct block_device *bdev, int size) |
68 | { | 69 | { |
69 | /* Size must be a power of two, and between 512 and PAGE_SIZE */ | 70 | /* Size must be a power of two, and between 512 and PAGE_SIZE */ |
70 | if (size > PAGE_SIZE || size < 512 || (size & (size-1))) | 71 | if (size > PAGE_SIZE || size < 512 || !is_power_of_2(size)) |
71 | return -EINVAL; | 72 | return -EINVAL; |
72 | 73 | ||
73 | /* Size cannot be smaller than the size supported by the device */ | 74 | /* Size cannot be smaller than the size supported by the device */ |