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>
This commit is contained in:
parent
d97a5e6050
commit
70eb8219ac
|
@ -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)));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue