[Devel] [PATCH RHEL9 COMMIT] dm-qcow2: fix a clang build error in the bitmap extension parser

Konstantin Khorenko khorenko at virtuozzo.com
Wed Nov 19 17:23:15 MSK 2025


The commit is pushed to "branch-rh9-5.14.0-427.92.1.vz9.88.x-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh9-5.14.0-427.92.1.vz9.88.8
------>
commit 7c4f828bd6d08fc775b19280296ac47b48f9e5c3
Author: Dmitry Sepp <dmitry.sepp at virtuozzo.com>
Date:   Mon Nov 17 13:46:26 2025 +0100

    dm-qcow2: fix a clang build error in the bitmap extension parser
    
    Clang is less forgiving than gcc and does not allow to declare variables in the
    middle of a case block.
    
    Fix the issue by correctly intoducing a new scope.
    
    The issue has been observed on:
    clang version 17.0.6 ( 17.0.6-5.vl9)
    Target: x86_64-redhat-linux-gnu
    Thread model: posix
    
    Fixes: 75034a7628f6 ("dm-qcow2: parse bitmap extension")
    Signed-off-by: Dmitry Sepp <dmitry.sepp at virtuozzo.com>
    
    Feature: dm-qcow2: block device over QCOW2 files driver
---
 drivers/md/dm-qcow2-target.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-qcow2-target.c b/drivers/md/dm-qcow2-target.c
index fac68db7082d5..b04ccbebba1c3 100644
--- a/drivers/md/dm-qcow2-target.c
+++ b/drivers/md/dm-qcow2-target.c
@@ -794,7 +794,7 @@ static int qcow2_parse_extensions(struct dm_target *ti, struct qcow2 *qcow2,
 		offset += sizeof(ext);
 
 		switch (ext.magic) {
-		case QCOW2_EXT_MAGIC_BITMAPS:
+		case QCOW2_EXT_MAGIC_BITMAPS: {
 			struct Qcow2BitmapHeaderExt bitmaps_ext;
 
 			if (ext.len != sizeof(bitmaps_ext)) {
@@ -814,6 +814,7 @@ static int qcow2_parse_extensions(struct dm_target *ti, struct qcow2 *qcow2,
 				return ret;
 			}
 			break;
+		}
 		case QCOW2_EXT_MAGIC_END:
 			return 0;
 		default:


More information about the Devel mailing list