diff options
author | Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> | 2011-12-06 01:41:27 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-12-06 01:41:27 +0100 |
commit | 8aedc4eaf6efbe9fda78821e38e395fb322e72d1 (patch) | |
tree | f4f5aa774a390bd1db4d7ccfb1cfb8943458167c /platform-intel.h | |
parent | imsm: FIX: Check maximum allowed degradation level in recover_backup_imsm() (diff) | |
download | mdadm-8aedc4eaf6efbe9fda78821e38e395fb322e72d1.tar.xz mdadm-8aedc4eaf6efbe9fda78821e38e395fb322e72d1.zip |
imsm: fix: does not allow to use invalid chunk size
Only least significant bit of chunk size provided by user has been used
in test with OROM capabilities. This way user could pass value which is
not a power of 2.
Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'platform-intel.h')
-rw-r--r-- | platform-intel.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/platform-intel.h b/platform-intel.h index 6c094d72..99450ba7 100644 --- a/platform-intel.h +++ b/platform-intel.h @@ -124,11 +124,13 @@ static inline int imsm_orom_has_raid5(const struct imsm_orom *orom) static inline int imsm_orom_has_chunk(const struct imsm_orom *orom, int chunk) { int fs = ffs(chunk); + int orom_chunk_bit; if (!fs) return 0; fs--; /* bit num to bit index */ - return !!(orom->sss & (1 << (fs - 1))); + orom_chunk_bit = (orom->sss & (1 << (fs - 1))); + return orom_chunk_bit && 1 << orom_chunk_bit == chunk; } |