Commit 7ba100d5 authored by Al Viro's avatar Al Viro Committed by Sasha Levin

fix ufs_isblockset()

[ Upstream commit 414cf718 ]

Cc: stable@vger.kernel.org
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent 7f805350
...@@ -473,15 +473,19 @@ static inline unsigned _ubh_find_last_zero_bit_( ...@@ -473,15 +473,19 @@ static inline unsigned _ubh_find_last_zero_bit_(
static inline int _ubh_isblockset_(struct ufs_sb_private_info * uspi, static inline int _ubh_isblockset_(struct ufs_sb_private_info * uspi,
struct ufs_buffer_head * ubh, unsigned begin, unsigned block) struct ufs_buffer_head * ubh, unsigned begin, unsigned block)
{ {
u8 mask;
switch (uspi->s_fpb) { switch (uspi->s_fpb) {
case 8: case 8:
return (*ubh_get_addr (ubh, begin + block) == 0xff); return (*ubh_get_addr (ubh, begin + block) == 0xff);
case 4: case 4:
return (*ubh_get_addr (ubh, begin + (block >> 1)) == (0x0f << ((block & 0x01) << 2))); mask = 0x0f << ((block & 0x01) << 2);
return (*ubh_get_addr (ubh, begin + (block >> 1)) & mask) == mask;
case 2: case 2:
return (*ubh_get_addr (ubh, begin + (block >> 2)) == (0x03 << ((block & 0x03) << 1))); mask = 0x03 << ((block & 0x03) << 1);
return (*ubh_get_addr (ubh, begin + (block >> 2)) & mask) == mask;
case 1: case 1:
return (*ubh_get_addr (ubh, begin + (block >> 3)) == (0x01 << (block & 0x07))); mask = 0x01 << (block & 0x07);
return (*ubh_get_addr (ubh, begin + (block >> 3)) & mask) == mask;
} }
return 0; return 0;
} }
......
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