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

Konstantin Khorenko khorenko at virtuozzo.com
Wed Nov 19 17:22:28 MSK 2025


The commit is pushed to "branch-rh10-6.12.0-55.13.1.2.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-55.13.1.2.18.vz10
------>
commit 6921dbac50416dec63e1893c67b47fac195f0240
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 b17343b4be975..b491052bd880a 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