From 320dad7d1b7c6ec8b758f18c3315b87a28570a75 Mon Sep 17 00:00:00 2001 From: loli10K Date: Tue, 25 Jun 2019 03:02:17 +0200 Subject: [PATCH] Fix bp_embedded_type enum definition With the addition of BP_EMBEDDED_TYPE_REDACTED in 30af21b0 a couple of codepaths make wrong assumptions and could potentially result in errors. Reviewed-by: Brian Behlendorf Reviewed-by: Chris Dunlop Reviewed-by: Paul Dagnelie Signed-off-by: loli10K Closes #8951 Conflicts: include/sys/spa.h --- include/sys/spa.h | 4 ++-- module/zfs/zio.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/sys/spa.h b/include/sys/spa.h index ca63d3a49058..d43801de5dd0 100644 --- a/include/sys/spa.h +++ b/include/sys/spa.h @@ -401,8 +401,8 @@ _NOTE(CONSTCOND) } while (0) typedef enum bp_embedded_type { BP_EMBEDDED_TYPE_DATA, - BP_EMBEDDED_TYPE_RESERVED, /* Reserved for an unintegrated feature. */ - NUM_BP_EMBEDDED_TYPES = BP_EMBEDDED_TYPE_RESERVED + BP_EMBEDDED_TYPE_RESERVED, /* Reserved for Delphix byteswap feature. */ + NUM_BP_EMBEDDED_TYPES } bp_embedded_type_t; #define BPE_NUM_WORDS 14 diff --git a/module/zfs/zio.c b/module/zfs/zio.c index f1bf377047a9..5638f5319381 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -908,7 +908,7 @@ zfs_blkptr_verify(spa_t *spa, const blkptr_t *bp) } if (BP_IS_EMBEDDED(bp)) { - if (BPE_GET_ETYPE(bp) > NUM_BP_EMBEDDED_TYPES) { + if (BPE_GET_ETYPE(bp) >= NUM_BP_EMBEDDED_TYPES) { zfs_panic_recover("blkptr at %p has invalid ETYPE %llu", bp, (longlong_t)BPE_GET_ETYPE(bp)); }