mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 02:49:32 +03:00
Add assertion to dsl_dataset_set_compression_sync
Coverity pointed out that if we somehow receive SPA_FEATURE_NONE, we will use a negative number as an array index. A defensive assertion seems appropriate. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Neal Gompa <ngompa@datto.com> Reviewed-by: Allan Jude <allan@klarasystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Closes #13872
This commit is contained in:
parent
d954ca19ba
commit
4a6e8b99f5
@ -4519,6 +4519,7 @@ dsl_dataset_set_compression_sync(void *arg, dmu_tx_t *tx)
|
||||
|
||||
uint64_t compval = ZIO_COMPRESS_ALGO(ddsca->ddsca_value);
|
||||
spa_feature_t f = zio_compress_to_feature(compval);
|
||||
ASSERT3S(f, !=, SPA_FEATURE_NONE);
|
||||
ASSERT3S(spa_feature_table[f].fi_type, ==, ZFEATURE_TYPE_BOOLEAN);
|
||||
|
||||
VERIFY0(dsl_dataset_hold(dp, ddsca->ddsca_name, FTAG, &ds));
|
||||
|
Loading…
Reference in New Issue
Block a user