From 2735a1cf59a00c41ec462bb8101011249b5f3f3d Mon Sep 17 00:00:00 2001 From: liyouhong Date: Wed, 27 May 2026 14:52:16 +0800 Subject: [PATCH] block/partitions/ldm: fix TOCBLOCK bitmap mismatch message argument order The ldm_crit() calls in ldm_parse_tocblock() have the format string arguments in the wrong order. The format string reads: "TOCBLOCK's first bitmap is '%s', should be '%s'." The intent is to print the actual (on-disk) name first and the expected name second. However, the constant TOC_BITMAP1/TOC_BITMAP2 (expected) is passed as the first argument and toc->bitmapX_name (actual) as the second, producing misleading diagnostic output on corrupt disks. Swap the two arguments so the printed message matches its intended semantics. Signed-off-by: liyouhong --- block/partitions/ldm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/partitions/ldm.c b/block/partitions/ldm.c index c0bdcae58a3ee..fca55f9a583e0 100644 --- a/block/partitions/ldm.c +++ b/block/partitions/ldm.c @@ -138,7 +138,7 @@ static bool ldm_parse_tocblock (const u8 *data, struct tocblock *toc) if (strncmp (toc->bitmap1_name, TOC_BITMAP1, sizeof (toc->bitmap1_name)) != 0) { ldm_crit ("TOCBLOCK's first bitmap is '%s', should be '%s'.", - TOC_BITMAP1, toc->bitmap1_name); + toc->bitmap1_name, TOC_BITMAP1); return false; } strscpy_pad(toc->bitmap2_name, data + 0x46, sizeof(toc->bitmap2_name)); @@ -147,7 +147,7 @@ static bool ldm_parse_tocblock (const u8 *data, struct tocblock *toc) if (strncmp (toc->bitmap2_name, TOC_BITMAP2, sizeof (toc->bitmap2_name)) != 0) { ldm_crit ("TOCBLOCK's second bitmap is '%s', should be '%s'.", - TOC_BITMAP2, toc->bitmap2_name); + toc->bitmap2_name, TOC_BITMAP2); return false; } ldm_debug ("Parsed TOCBLOCK successfully.");