diff options
author | Hawrylewicz Czarnowski, Przemyslaw <przemyslaw.hawrylewicz.czarnowski@intel.com> | 2011-12-07 02:15:55 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-12-07 02:15:55 +0100 |
commit | 70eb8219ac128ca88c1beff1e9cf48ed23846eea (patch) | |
tree | 704ceefdaab4dcb0ad360d7ed314232304b05950 /platform-intel.h | |
parent | Report raid level type to syslog on RebuildFinished event. (diff) | |
download | mdadm-70eb8219ac128ca88c1beff1e9cf48ed23846eea.tar.xz mdadm-70eb8219ac128ca88c1beff1e9cf48ed23846eea.zip |
fix: imsm: validate strip size - tuned up
Neil's proposal seems more reasonable and shows what is really going on
here.
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 | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/platform-intel.h b/platform-intel.h index 99450ba7..c997f1b8 100644 --- a/platform-intel.h +++ b/platform-intel.h @@ -124,13 +124,12 @@ 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 */ - orom_chunk_bit = (orom->sss & (1 << (fs - 1))); - return orom_chunk_bit && 1 << orom_chunk_bit == chunk; + if (chunk & (chunk-1)) + return 0; /* not a power of 2 */ + return !!(orom->sss & (1 << (fs - 1))); } |