Commit e1b5c1d3 authored by Vignesh Babu BM's avatar Vignesh Babu BM Committed by Linus Torvalds

is_power_of_2 in fs/hfs

Replace (n & (n-1)) in the context of power of 2 checks with is_power_of_2
Signed-off-by: default avatarvignesh babu <vignesh.babu@wipro.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e7d709c0
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
*/ */
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/log2.h>
#include "btree.h" #include "btree.h"
...@@ -76,7 +77,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke ...@@ -76,7 +77,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
tree->depth = be16_to_cpu(head->depth); tree->depth = be16_to_cpu(head->depth);
size = tree->node_size; size = tree->node_size;
if (!size || size & (size - 1)) if (!is_power_of_2(size))
goto fail_page; goto fail_page;
if (!tree->node_count) if (!tree->node_count)
goto fail_page; goto fail_page;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/log2.h>
#include "hfsplus_fs.h" #include "hfsplus_fs.h"
#include "hfsplus_raw.h" #include "hfsplus_raw.h"
...@@ -69,7 +70,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id) ...@@ -69,7 +70,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id)
} }
size = tree->node_size; size = tree->node_size;
if (!size || size & (size - 1)) if (!is_power_of_2(size))
goto fail_page; goto fail_page;
if (!tree->node_count) if (!tree->node_count)
goto fail_page; goto fail_page;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment